Add CONFIG_PATH environment variable for configurable config file location

- Replace hardcoded remotes.yaml path with CONFIG_PATH environment variable
- Update docker-compose.yml to set CONFIG_PATH=/app/remotes.yaml
- Application now requires CONFIG_PATH to be set, enabling flexible deployment
This commit is contained in:
Ben Vincent 2026-01-06 21:35:37 +11:00
parent 46711eec6a
commit 666ad08518
2 changed files with 5 additions and 1 deletions

View File

@ -9,6 +9,7 @@ services:
ports: ports:
- "8000:8000" - "8000:8000"
environment: environment:
- CONFIG_PATH=/app/remotes.yaml
- DBHOST=postgres - DBHOST=postgres
- DBPORT=5432 - DBPORT=5432
- DBUSER=artifacts - DBUSER=artifacts

View File

@ -23,7 +23,10 @@ class ArtifactRequest(BaseModel):
app = FastAPI(title="Artifact Storage API", version="2.0.0") app = FastAPI(title="Artifact Storage API", version="2.0.0")
# Initialize components using config # Initialize components using config
config = ConfigManager("remotes.yaml") config_path = os.environ.get("CONFIG_PATH")
if not config_path:
raise ValueError("CONFIG_PATH environment variable is required")
config = ConfigManager(config_path)
# Get configurations # Get configurations
s3_config = config.get_s3_config() s3_config = config.get_s3_config()