refactor: replace config.yml with .env for all configuration

All settings (auth credentials, scanner ranges, status_checker interval)
now live in a single .env file via pydantic-settings. config.yml and
config.yml.example are deleted.

- Settings: add auth_username, auth_password_hash, scanner_ranges,
  status_checker_interval; add load_overrides()/save_overrides() for
  persisting runtime changes to data/scan_config.json
- auth.py: read credentials directly from settings
- scan.py: read ranges/interval from settings; write-back via save_overrides()
- scheduler.py: read interval directly from settings
- main.py: call settings.load_overrides() at startup
- docker-compose.yml: remove config.yml volume mount, add new env vars
- conftest.py: set settings fields directly instead of writing a temp config.yml
This commit is contained in:
Pouzor
2026-03-09 11:26:49 +01:00
parent acc5bc6a64
commit a56204a5f2
18 changed files with 117 additions and 212 deletions
+4 -2
View File
@@ -7,11 +7,13 @@ services:
environment:
SECRET_KEY: ${SECRET_KEY:?SECRET_KEY must be set in the environment or a .env file}
SQLITE_PATH: /app/data/homelab.db
CONFIG_PATH: /app/config.yml
CORS_ORIGINS: '["http://localhost:3000"]'
AUTH_USERNAME: ${AUTH_USERNAME:-admin}
AUTH_PASSWORD_HASH: ${AUTH_PASSWORD_HASH:?AUTH_PASSWORD_HASH must be set}
SCANNER_RANGES: ${SCANNER_RANGES:-["192.168.1.0/24"]}
STATUS_CHECKER_INTERVAL: ${STATUS_CHECKER_INTERVAL:-60}
volumes:
- backend_data:/app/data
- ./backend/config.yml:/app/config.yml
networks:
- homelable
# Required for ping-based status checks