mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 13:23:00 +00:00
permission rabbithole
Chasing permission changes now that I've adjusted root folder structure
This commit is contained in:
@@ -4,12 +4,9 @@ from typing import Dict, Any
|
|||||||
|
|
||||||
class ConfigManager:
|
class ConfigManager:
|
||||||
def __init__(self, config_path: str = None, secrets_path: str = None):
|
def __init__(self, config_path: str = None, secrets_path: str = None):
|
||||||
# Get the project root directory
|
# Use current working directory as base
|
||||||
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
self.config_path = config_path or "config/config.json"
|
||||||
|
self.secrets_path = secrets_path or "config/config_secrets.json"
|
||||||
# Set default paths relative to project root
|
|
||||||
self.config_path = config_path or os.path.join(project_root, "config", "config.json")
|
|
||||||
self.secrets_path = secrets_path or os.path.join(project_root, "config", "config_secrets.json")
|
|
||||||
|
|
||||||
self.config: Dict[str, Any] = {}
|
self.config: Dict[str, Any] = {}
|
||||||
self.load_config()
|
self.load_config()
|
||||||
@@ -18,6 +15,7 @@ class ConfigManager:
|
|||||||
"""Load configuration from JSON files."""
|
"""Load configuration from JSON files."""
|
||||||
try:
|
try:
|
||||||
# Load main config
|
# Load main config
|
||||||
|
print(f"Attempting to load config from: {os.path.abspath(self.config_path)}")
|
||||||
with open(self.config_path, 'r') as f:
|
with open(self.config_path, 'r') as f:
|
||||||
self.config = json.load(f)
|
self.config = json.load(f)
|
||||||
|
|
||||||
@@ -30,11 +28,14 @@ class ConfigManager:
|
|||||||
|
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
if str(e).find('config_secrets.json') == -1: # Only raise if main config is missing
|
if str(e).find('config_secrets.json') == -1: # Only raise if main config is missing
|
||||||
print(f"Configuration file not found at {self.config_path}")
|
print(f"Configuration file not found at {os.path.abspath(self.config_path)}")
|
||||||
raise
|
raise
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
print("Error parsing configuration file")
|
print("Error parsing configuration file")
|
||||||
raise
|
raise
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error loading configuration: {str(e)}")
|
||||||
|
raise
|
||||||
|
|
||||||
def _deep_merge(self, target: Dict, source: Dict) -> None:
|
def _deep_merge(self, target: Dict, source: Dict) -> None:
|
||||||
"""Deep merge source dict into target dict."""
|
"""Deep merge source dict into target dict."""
|
||||||
|
|||||||
Reference in New Issue
Block a user