fix(08): fix infinite recursion in config manager
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
830554
|
831167
|
||||||
830555
|
831168
|
||||||
830569
|
831182
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
import logging
|
import logging
|
||||||
from .config_loader import load_config, get_config
|
from .config_loader import load_config as loader_load_config, get_config as loader_get_config
|
||||||
|
|
||||||
log = logging.getLogger("ainventory")
|
log = logging.getLogger("ainventory")
|
||||||
|
|
||||||
@@ -52,8 +52,8 @@ class ConfigManager:
|
|||||||
log.info(f"✅ Updated {path} with new values.")
|
log.info(f"✅ Updated {path} with new values.")
|
||||||
|
|
||||||
# Reload the global config
|
# Reload the global config
|
||||||
load_config()
|
loader_load_config()
|
||||||
return get_config()
|
return loader_get_config()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(f"❌ Failed to write {path}: {e}")
|
log.error(f"❌ Failed to write {path}: {e}")
|
||||||
raise
|
raise
|
||||||
@@ -103,8 +103,8 @@ class ConfigManager:
|
|||||||
log.info(f"✅ Updated {path} with new secrets.")
|
log.info(f"✅ Updated {path} with new secrets.")
|
||||||
|
|
||||||
# Reload the global config
|
# Reload the global config
|
||||||
load_config()
|
loader_load_config()
|
||||||
return get_config()
|
return loader_get_config()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error(f"❌ Failed to write {path}: {e}")
|
log.error(f"❌ Failed to write {path}: {e}")
|
||||||
raise
|
raise
|
||||||
@@ -133,17 +133,17 @@ class ConfigManager:
|
|||||||
if backend_updates:
|
if backend_updates:
|
||||||
ConfigManager.update_config(backend_updates)
|
ConfigManager.update_config(backend_updates)
|
||||||
|
|
||||||
return get_config()
|
return loader_get_config()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_config() -> dict:
|
def get_config() -> dict:
|
||||||
"""Return the current global configuration."""
|
"""Return the current global configuration."""
|
||||||
return get_config()
|
return loader_get_config()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_masked_key(key_name: str):
|
def get_masked_key(key_name: str):
|
||||||
"""Returns a masked version of a configuration value or env var."""
|
"""Returns a masked version of a configuration value or env var."""
|
||||||
config = get_config()
|
config = loader_get_config()
|
||||||
|
|
||||||
# Try to find in config first
|
# Try to find in config first
|
||||||
val = None
|
val = None
|
||||||
@@ -183,7 +183,7 @@ def update_config(updates: dict) -> dict:
|
|||||||
|
|
||||||
def get_config() -> dict:
|
def get_config() -> dict:
|
||||||
"""Return the current global configuration."""
|
"""Return the current global configuration."""
|
||||||
return ConfigManager.get_config()
|
return loader_get_config()
|
||||||
|
|
||||||
def validate_config_file() -> bool:
|
def validate_config_file() -> bool:
|
||||||
"""Validate backend.yaml syntax and required fields."""
|
"""Validate backend.yaml syntax and required fields."""
|
||||||
|
|||||||
BIN
backups/ainventory_2026-04-23_14-45-07.tar.gz
Normal file
BIN
backups/ainventory_2026-04-23_14-45-07.tar.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user