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:
+11
-1
@@ -1,4 +1,14 @@
|
||||
SECRET_KEY=<generate with: python3 -c "import secrets; print(secrets.token_urlsafe(32))">
|
||||
SQLITE_PATH=./data/homelab.db
|
||||
CONFIG_PATH=./config.yml
|
||||
CORS_ORIGINS=["http://localhost:5173","http://localhost:3000"]
|
||||
|
||||
# Auth — set a strong password hash (generate with passlib):
|
||||
# python3 -c "from passlib.context import CryptContext; print(CryptContext(schemes=['bcrypt']).hash('yourpassword'))"
|
||||
AUTH_USERNAME=admin
|
||||
AUTH_PASSWORD_HASH=
|
||||
|
||||
# Scanner — JSON array of CIDR ranges to scan
|
||||
SCANNER_RANGES=["192.168.1.0/24"]
|
||||
|
||||
# Status checker interval in seconds
|
||||
STATUS_CHECKER_INTERVAL=60
|
||||
|
||||
Reference in New Issue
Block a user