|
4 | 4 |
|
5 | 5 | from dotenv import load_dotenv
|
6 | 6 | from dynaconf import Dynaconf, Validator
|
| 7 | +from macrostrat.app_frame.control_command import BackendType |
| 8 | +from macrostrat.utils import get_logger |
7 | 9 | from pydantic import BaseModel
|
8 | 10 | from sqlalchemy.engine import make_url
|
9 | 11 | from sqlalchemy.engine.url import URL
|
10 | 12 | from toml import load as load_toml
|
11 | 13 |
|
12 |
| -from macrostrat.app_frame.control_command import BackendType |
13 |
| -from macrostrat.utils import get_logger |
14 |
| - |
15 | 14 | from .utils import find_macrostrat_config
|
16 | 15 |
|
17 | 16 | log = get_logger(__name__)
|
@@ -52,11 +51,18 @@ def all_environments(self):
|
52 | 51 |
|
53 | 52 | settings = MacrostratConfig()
|
54 | 53 |
|
| 54 | + |
| 55 | +def convert_to_string(value): |
| 56 | + if value is None: |
| 57 | + return None |
| 58 | + return str(value) |
| 59 | + |
| 60 | + |
55 | 61 | settings.validators.register(
|
56 | 62 | # `must_exist` is causing huge problems
|
57 | 63 | Validator("COMPOSE_ROOT", cast=Path),
|
58 | 64 | Validator("env_files", cast=list[Path]),
|
59 |
| - Validator("pg_database", cast=str, default=None), |
| 65 | + Validator("pg_database", cast=convert_to_string, default=None), |
60 | 66 | # Backend information. We could potentially infer this from other environment variables
|
61 | 67 | Validator("backend", default="kubernetes", cast=BackendType),
|
62 | 68 | )
|
|
0 commit comments