(filename)
| 103 | |
| 104 | # Load JSON configuration file |
| 105 | def load_json_config(filename): |
| 106 | try: |
| 107 | # If environment variable is set, use the directory specified by it |
| 108 | if CONFIG_DIR: |
| 109 | config_path = Path(CONFIG_DIR) / filename |
| 110 | else: |
| 111 | # Otherwise use default directory |
| 112 | config_path = Path(__file__).parent / "config" / filename |
| 113 | |
| 114 | logger.info(f"Loading configuration from {config_path}") |
| 115 | |
| 116 | if not config_path.exists(): |
| 117 | logger.warning(f"Configuration file {config_path} does not exist") |
| 118 | return {} |
| 119 | |
| 120 | with open(config_path, 'r', encoding='utf-8') as f: |
| 121 | config = json.load(f) |
| 122 | config = replace_env_placeholders(config) |
| 123 | return config |
| 124 | except Exception as e: |
| 125 | logger.error(f"Error loading configuration file {filename}: {str(e)}") |
| 126 | return {} |
| 127 | |
| 128 | # Load generator model configuration |
| 129 | def load_generator_config(): |
no test coverage detected