Never hard-code configuration values in source code. All configurable values (hosts, ports, credentials, feature flags, etc.) must be defined in config/*.props files and accessed via ConfigLoader.
config/- Configuration.propsfiles (base + environment overrides)src/config/- Python config module (loader, constants)main.py- Application entry point
from src.config import ConfigLoader, Sections, Keys
config = ConfigLoader() # or ConfigLoader(env="dev")
value = config.get(Sections.SECTION, Keys.KEY)When adding new configuration:
- Add the value to
config/config.props - Add the section name to
Sectionsclass insrc/config/constants.py - Add the key name to
Keysclass insrc/config/constants.py - Access via
ConfigLoaderin your code
- Run:
python main.py