YAML Configuration
Oridecon merges user-defined YAML files, environment variables, and code defaults into a single typed configuration object. This page covers the mechanics; for a task-oriented walkthrough see Configuration.
1. The Configuration File
Section titled “1. The Configuration File”The primary file is application.yaml in the project root. Core settings are top-level; each extension reads its own named section:
app_name: "order-service"debug: falseenv: "production"
sql: # oridecon-sql (config_key: "sql") backend: url: "${DATABASE_URL:sqlite+aiosqlite:///./dev.db}" pool: min_size: 2 max_size: 10
cache: # oridecon-cache (config_key: "cache") backends: - name: redis type: redis default: true redis_url: "${REDIS_URL}"Loading config
Section titled “Loading config”from oridecon import OrideconConfig
config = OrideconConfig.from_yaml() # ./application.yaml (CWD)config = OrideconConfig.from_yaml("config/application.yaml")config = OrideconConfig.from_env_profile() # recommended: same file, plus ORI_PROFILERelative paths resolve from the process CWD. A missing file is not an error — Oridecon logs config.defaults_only and uses code defaults. Both loaders overlay application.{profile}.yaml when ORI_PROFILE is set (or profile= is passed), then apply ORI_* env vars. Application() with no config calls from_env_profile().
2. Environment Interpolation
Section titled “2. Environment Interpolation”Oridecon resolves ${VAR} placeholders inside YAML values at load time:
${PORT}— resolves to thePORTenv var; fails fast if unset.${PORT:8080}— resolves toPORT, or8080if unset.
sql: backend: url: "${DATABASE_URL:sqlite+aiosqlite:///./dev.db}"3. Environment-Variable Overrides
Section titled “3. Environment-Variable Overrides”Beyond interpolation, any key can be overridden by an environment variable using the ORI_ prefix and double underscores (__) for nesting. This is the highest-priority source:
sql.backend.url → ORI_SQL__BACKEND__URLweb.server.port → ORI_WEB__SERVER__PORTauth.secret_key → ORI_AUTH__SECRET_KEYThe prefix is stripped and the rest is lowercased; __ becomes nesting. List indexes are not special — ORI_FOO__0__BAR becomes a dict key "0", not foo[0].
ORI_WEB__SERVER__PORT=9000 oridecon run4. Configuration Profiles
Section titled “4. Configuration Profiles”Override base settings per environment with profile files. Activate a profile with ORI_PROFILE:
ORI_PROFILE=production oridecon run- Base:
application.yaml - Overlay:
application.{profile}.yaml(e.g.application.production.yaml)
5. Precedence Rules
Section titled “5. Precedence Rules”When resolving a key, Oridecon applies sources in this order (highest priority wins):
ORI_environment variables —ORI_WEB__SERVER__PORT=9000overrides everything- Profile YAML — values from
application.{profile}.yaml - Base YAML — values from
application.yaml - Code defaults — defined in each config model
6. Typed Sections and get_section()
Section titled “6. Typed Sections and get_section()”OrideconConfig exposes typed top-level fields and resolves extension sections on demand:
config = OrideconConfig.from_yaml()
# Typed top-levelconfig.app_name # "order-service"config.debug # Falseconfig.environment # Environment.PRODUCTION
# Extension sections — pass the config model to get a typed object backdb_config = config.get_section("sql", DatabaseConfig)
# Dotted pathsrag_config = config.get_section("ai_rag", RAGConfig)
# Existence checkconfig.has_section("web") # TrueProviders rarely call get_section() themselves — declaring config_key and config_model makes the framework inject the typed section automatically. See Configuration → auto-injection.
7. Profile Examples
Section titled “7. Profile Examples”debug: truelogging: level: DEBUG json_format: falsesql: backend: url: "sqlite+aiosqlite:///./dev.db"debug: falselogging: level: WARNING json_format: truecache: backends: - name: redis type: redis default: true redis_url: "${REDIS_URL}"Inspect the resolved tree (secrets masked):
oridecon config showoridecon config validateoridecon config doctor --env productionNext Steps
Section titled “Next Steps”- Configuration — the practical guide
- The oridecon CLI —
config show,config doctor,config env - Application Lifecycle — when config is loaded during boot
- Environment variables — generated
ORI_*registry