add -config CLI param
This commit is contained in:
Binary file not shown.
@@ -130,6 +130,7 @@ _user_interaction_lock = threading.Lock()
|
||||
# Global variables (mutable, set at runtime - not constants)
|
||||
inclusions_mapping_config = []
|
||||
organizations_mapping_config = []
|
||||
_dashboard_config_path_override = None # Set by --config CLI arg if provided
|
||||
excel_export_config = None
|
||||
excel_export_enabled = False
|
||||
|
||||
@@ -152,6 +153,19 @@ if "--debug" in sys.argv:
|
||||
sys.argv.remove("--debug")
|
||||
enable_debug_mode()
|
||||
|
||||
# Handle --config <path> override (remove from sys.argv to preserve positional args)
|
||||
if "--config" in sys.argv:
|
||||
_idx = sys.argv.index("--config")
|
||||
if _idx + 1 >= len(sys.argv):
|
||||
print("Error: --config requires a file path argument")
|
||||
sys.exit(1)
|
||||
_raw_config_path = sys.argv[_idx + 1]
|
||||
del sys.argv[_idx:_idx + 2]
|
||||
if os.path.isabs(_raw_config_path):
|
||||
_dashboard_config_path_override = _raw_config_path
|
||||
else:
|
||||
_dashboard_config_path_override = os.path.join(get_config_path(), _raw_config_path)
|
||||
|
||||
# --- Progress Bar Configuration ---
|
||||
# NOTE: BAR_N_FMT_WIDTH, BAR_TOTAL_FMT_WIDTH, BAR_TIME_WIDTH, BAR_RATE_WIDTH
|
||||
# are imported from eb_dashboard_constants.py (SINGLE SOURCE OF TRUTH)
|
||||
@@ -457,7 +471,7 @@ def load_json_file(filename):
|
||||
def load_inclusions_mapping_config():
|
||||
"""Loads and validates the inclusions mapping configuration from the Excel file."""
|
||||
global inclusions_mapping_config
|
||||
config_path = os.path.join(get_config_path(), DASHBOARD_CONFIG_FILE_NAME)
|
||||
config_path = _dashboard_config_path_override or os.path.join(get_config_path(), DASHBOARD_CONFIG_FILE_NAME)
|
||||
|
||||
try:
|
||||
# Load with data_only=True to read calculated values instead of formulas
|
||||
@@ -559,7 +573,7 @@ def load_inclusions_mapping_config():
|
||||
def load_organizations_mapping_config():
|
||||
"""Loads and validates the organizations mapping configuration from the Excel file."""
|
||||
global organizations_mapping_config
|
||||
config_path = os.path.join(get_config_path(), DASHBOARD_CONFIG_FILE_NAME)
|
||||
config_path = _dashboard_config_path_override or os.path.join(get_config_path(), DASHBOARD_CONFIG_FILE_NAME)
|
||||
|
||||
try:
|
||||
# Load with data_only=True to read calculated values instead of formulas
|
||||
|
||||
Reference in New Issue
Block a user