Skip to content

Commit

Permalink
Some more test-configuration updates
Browse files Browse the repository at this point in the history
  • Loading branch information
davenquinn committed Jan 8, 2025
1 parent d29067c commit e6f0d7b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions core/macrostrat/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

from dotenv import load_dotenv
from dynaconf import Dynaconf, Validator
from macrostrat.app_frame.control_command import BackendType
from macrostrat.utils import get_logger
from pydantic import BaseModel
from sqlalchemy.engine import make_url
from sqlalchemy.engine.url import URL
from toml import load as load_toml

from macrostrat.app_frame.control_command import BackendType
from macrostrat.utils import get_logger

from .utils import find_macrostrat_config

log = get_logger(__name__)
Expand Down Expand Up @@ -52,11 +51,18 @@ def all_environments(self):

settings = MacrostratConfig()


def convert_to_string(value):
if value is None:
return None
return str(value)


settings.validators.register(
# `must_exist` is causing huge problems
Validator("COMPOSE_ROOT", cast=Path),
Validator("env_files", cast=list[Path]),
Validator("pg_database", cast=str, default=None),
Validator("pg_database", cast=convert_to_string, default=None),
# Backend information. We could potentially infer this from other environment variables
Validator("backend", default="kubernetes", cast=BackendType),
)
Expand Down

0 comments on commit e6f0d7b

Please sign in to comment.