From 526150d4caf778191461650b26ea0e21d0d98643 Mon Sep 17 00:00:00 2001 From: Daniel Chalef <131175+danielchalef@users.noreply.github.com> Date: Thu, 30 Oct 2025 21:24:54 -0700 Subject: [PATCH] fix: Handle default config path and empty env vars correctly - Change default config path from 'config.yaml' to 'config/config.yaml' - Fix env var expansion to return None for empty strings instead of False - Prevents validation errors when optional string fields have unset env vars --- mcp_server/src/config/schema.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mcp_server/src/config/schema.py b/mcp_server/src/config/schema.py index 6aee4cf2..70514e82 100644 --- a/mcp_server/src/config/schema.py +++ b/mcp_server/src/config/schema.py @@ -42,8 +42,11 @@ class YamlSettingsSource(PydanticBaseSettingsSource): lower_result = result.lower().strip() if lower_result in ('true', '1', 'yes', 'on'): return True - elif lower_result in ('false', '0', 'no', 'off', ''): + elif lower_result in ('false', '0', 'no', 'off'): return False + elif lower_result == '': + # Empty string means env var not set - return None for optional fields + return None return result else: # Otherwise, do string substitution (keep as strings for partial replacements) @@ -247,7 +250,7 @@ class GraphitiConfig(BaseSettings): file_secret_settings: PydanticBaseSettingsSource, ) -> tuple[PydanticBaseSettingsSource, ...]: """Customize settings sources to include YAML.""" - config_path = Path(os.environ.get('CONFIG_PATH', 'config.yaml')) + config_path = Path(os.environ.get('CONFIG_PATH', 'config/config.yaml')) yaml_settings = YamlSettingsSource(settings_cls, config_path) # Priority: CLI args (init) > env vars > yaml > defaults return (init_settings, env_settings, yaml_settings, dotenv_settings)