Configuration — Aquilia Documentation
Comprehensive guide and documentation for Configuration in the Aquilia framework. View API reference, examples, and implementation patterns.
Configuration System aquilia.pyconfig — Pure Python, zero YAML Aquilia's configuration system is pure Python. There is no YAML, no TOML, no JSON. Everything — application structure, modules, integrations, and environment-specific settings — lives in a single workspace.py file. AquilaConfig subclasses carry the environment config; the Workspace builder wires it all together. workspace.py single source of truth , , , , ].map(( , i) => ( ))} Why pure Python config? , , , ].map(( ) => ( ))} workspace.py — the single file Everything lives in workspace.py at the project root. The AquilaConfig subclasses declare environment-specific settings with Env bindings and Secret fields. The Workspace builder wires modules and typed integration dataclasses. At runtime, .env_config(BaseEnv) reads AQ_ENV to select the right subclass automatically. ConfigLoader — the internal bridge When the server starts, AquilaConfig.to_loader() converts your class hierarchy into a ConfigLoader instance that all internal subsystems read from. You never instantiate ConfigLoader directly — the framework does it during boot. You interact with it only in advanced scenarios (tests, plugins, custom CLI commands). Value resolution precedence When multiple sources define the same key, this order wins. Higher rows always take priority — the process environment (Docker, Kubernetes, CI/CD) always wins over source defaults. Priority Source How and loads before first access'], ['3', 'AquilaConfig literal fields', 'Class-level assignments in your section subclasses'], ['4 — Lowest', 'Built-in defaults', 'Aquilia\'s defaults inside AquilaConfig.Server, .Auth, .Database, etc.'], ].map(([priority, source, how], i) => ( ))} Environment selection at runtime .env_config(BaseEnv) scans all subclasses of BaseEnv and picks the one whose env attribute matches the AQ_ENV environment variable. If AQ_ENV is not set, it falls back to "dev". Inspecting config values Use .to_dict() to see the fully-resolved, serialised config at any point. All Env descriptors are resolved and all Secret values are revealed in the dict — handle it accordingly. Testing config Use AquilaConfig.clear_all_caches() between tests to reset all resolved caches and the dotenv loader state. Combine with monkeypatch.setenv() to simulate different environments. ))} )
Go to Homepage