feat(config): add automatic config directory detection for existing yaml files

- Update get_default_config_dir to check for existing YAML files in addition to sample files
This commit is contained in:
bobokun 2025-08-28 18:22:21 -04:00
parent 2f15302a96
commit 19aa766094
No known key found for this signature in database
GPG key ID: B73932169607D927
3 changed files with 4 additions and 3 deletions

View file

@ -1 +1 @@
4.5.6-develop8
4.5.6-develop9

View file

@ -290,7 +290,8 @@ def get_default_config_dir(config_hint: str = None) -> str:
# 3) Fallbacks
has_yaml_sample = glob.glob(os.path.join("/config", "*.yml.sample")) or glob.glob(os.path.join("/config", "*.yaml.sample"))
if os.path.isdir("/config") and has_yaml_sample:
has_yaml = glob.glob(os.path.join("/config", "*.yml")) or glob.glob(os.path.join("/config", "*.yaml"))
if os.path.isdir("/config") and (has_yaml_sample or has_yaml):
return "/config"
return str(_platform_config_base())

View file

@ -887,7 +887,7 @@ class WebAPI:
logger.trace(f"Data to write: {data}")
# Convert !ENV strings back to EnvStr objects
processed_data = self._convert_env_strings_to_objects(data)
processed_data = self._restore_env_objects(data)
# Use the custom YAML class with format preservation
if config_path.exists():