Skip to content

Commit e6f0d7b

Browse files
committed
Some more test-configuration updates
1 parent d29067c commit e6f0d7b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

core/macrostrat/core/config.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44

55
from dotenv import load_dotenv
66
from dynaconf import Dynaconf, Validator
7+
from macrostrat.app_frame.control_command import BackendType
8+
from macrostrat.utils import get_logger
79
from pydantic import BaseModel
810
from sqlalchemy.engine import make_url
911
from sqlalchemy.engine.url import URL
1012
from toml import load as load_toml
1113

12-
from macrostrat.app_frame.control_command import BackendType
13-
from macrostrat.utils import get_logger
14-
1514
from .utils import find_macrostrat_config
1615

1716
log = get_logger(__name__)
@@ -52,11 +51,18 @@ def all_environments(self):
5251

5352
settings = MacrostratConfig()
5453

54+
55+
def convert_to_string(value):
56+
if value is None:
57+
return None
58+
return str(value)
59+
60+
5561
settings.validators.register(
5662
# `must_exist` is causing huge problems
5763
Validator("COMPOSE_ROOT", cast=Path),
5864
Validator("env_files", cast=list[Path]),
59-
Validator("pg_database", cast=str, default=None),
65+
Validator("pg_database", cast=convert_to_string, default=None),
6066
# Backend information. We could potentially infer this from other environment variables
6167
Validator("backend", default="kubernetes", cast=BackendType),
6268
)

0 commit comments

Comments
 (0)