Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/cli/modules/server_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
This module handles all configuration file operations without any CLI/presentation logic.
"""
import json
import os
from pathlib import Path
from typing import Optional, Dict, Any, List

Expand All @@ -16,11 +17,16 @@ def __init__(self, config_file: Optional[Path] = None):
Initialize ServerConfig with a config file path.

Args:
config_file: Path to the config file. If None, defaults to openarc_config.json in project root.
config_file: Path to the config file. If None, OPENARC_CONFIG_FILE env var when set,
otherwise defaults to openarc_config.json in project root.
"""
if config_file is None:
project_root = Path(__file__).parent.parent.parent.parent
config_file = project_root / "openarc_config.json"
env_path = os.environ.get("OPENARC_CONFIG_FILE")
if env_path:
config_file = Path(env_path)
else:
project_root = Path(__file__).parent.parent.parent.parent
config_file = project_root / "openarc_config.json"

self.config_file = Path(config_file)

Expand Down
3 changes: 2 additions & 1 deletion src/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ async def lifespan(app: FastAPI):
if models:
from pathlib import Path

config_file = Path(__file__).parent.parent.parent / "openarc_config.json"
env_config = os.environ.get("OPENARC_CONFIG_FILE")
config_file = Path(env_config) if env_config else Path(__file__).parent.parent.parent / "openarc_config.json"
if config_file.exists():
with open(config_file) as f:
config = json.load(f)
Expand Down