fix(08): fix infinite recursion in config manager
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
830554
|
||||
830555
|
||||
830569
|
||||
831167
|
||||
831168
|
||||
831182
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
import yaml
|
||||
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")
|
||||
|
||||
@@ -52,8 +52,8 @@ class ConfigManager:
|
||||
log.info(f"✅ Updated {path} with new values.")
|
||||
|
||||
# Reload the global config
|
||||
load_config()
|
||||
return get_config()
|
||||
loader_load_config()
|
||||
return loader_get_config()
|
||||
except Exception as e:
|
||||
log.error(f"❌ Failed to write {path}: {e}")
|
||||
raise
|
||||
@@ -103,8 +103,8 @@ class ConfigManager:
|
||||
log.info(f"✅ Updated {path} with new secrets.")
|
||||
|
||||
# Reload the global config
|
||||
load_config()
|
||||
return get_config()
|
||||
loader_load_config()
|
||||
return loader_get_config()
|
||||
except Exception as e:
|
||||
log.error(f"❌ Failed to write {path}: {e}")
|
||||
raise
|
||||
@@ -133,17 +133,17 @@ class ConfigManager:
|
||||
if backend_updates:
|
||||
ConfigManager.update_config(backend_updates)
|
||||
|
||||
return get_config()
|
||||
return loader_get_config()
|
||||
|
||||
@staticmethod
|
||||
def get_config() -> dict:
|
||||
"""Return the current global configuration."""
|
||||
return get_config()
|
||||
return loader_get_config()
|
||||
|
||||
@staticmethod
|
||||
def get_masked_key(key_name: str):
|
||||
"""Returns a masked version of a configuration value or env var."""
|
||||
config = get_config()
|
||||
config = loader_get_config()
|
||||
|
||||
# Try to find in config first
|
||||
val = None
|
||||
@@ -183,7 +183,7 @@ def update_config(updates: dict) -> dict:
|
||||
|
||||
def get_config() -> dict:
|
||||
"""Return the current global configuration."""
|
||||
return ConfigManager.get_config()
|
||||
return loader_get_config()
|
||||
|
||||
def validate_config_file() -> bool:
|
||||
"""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