Files
TimeTracker/app
Dries Peeters 50f9bbbbae feat: implement configuration priority system (WebUI > .env > defaults)
Implement a configuration management system where settings changed via
WebUI take priority over .env values, while .env values are used as initial
startup values.

Changes:
- Update ConfigManager.get_setting() to check Settings model first, then
  environment variables, ensuring WebUI changes have highest priority
- Add Settings._initialize_from_env() method to initialize new Settings
  instances from .env file values on first creation
- Update Settings.get_settings() to automatically initialize from .env
  when creating a new Settings instance
- Add Settings initialization in create_app() to ensure .env values are
  loaded on application startup
- Add comprehensive test suite (test_config_priority.py) covering:
  * Settings priority over environment variables
  * .env values used as initial startup values
  * WebUI changes persisting and taking priority
  * Proper type handling for different setting types

This ensures that:
1. .env file values are used as initial configuration on first startup
2. Settings changed via WebUI are saved to database and take priority
3. Configuration priority order: Settings (DB) > .env > app config > defaults

Fixes configuration management workflow where users can set initial values
in .env but override them permanently via WebUI without modifying .env.
2025-11-28 16:19:03 +01:00
..