OxL Reference

14.1 Static configuration

oxl
config App {
  dbUrl: DbUrl
  port: Port = DEFAULT_PORT
  stripeKey: secret<str>
  profile dev  { dbUrl = "sqlite://dev.db" }
  profile prod { port = 443 }
}

let app = App.get()
  • config Name { … } declares a typed config. Fields are as in data; profile name { field = value } sets the values of a profile.
  • Sources in order of priority: the flag --set App.port=8080 → the environment variable APP_PORT (the config name and the field in UPPER_SNAKE_CASE, nesting through __) → the file config/<profile>.toml → the profile block → the default value.
  • The profile is selected by the flag --profile or OXL_PROFILE; dev by default.
  • The config is loaded at step 2 of start-up (§2.4). An unknown key, a wrong type, a refinement violation or a missing required field — a message naming the source and termination with exit code 78.
  • App.get() returns Arc<frozen App>; the value does not change until restart.
  • const is for values known at build time and independent of the environment.

config-type

See also

Source: docs/spec/oxl-standard.en.md