# ch-config
Typed configuration for Rust apps.
## Installation
```toml
[dependencies]
ch-config = "0.2.0"
```
Requires Rust 1.99 or newer.
## Usage
`load_app_config` applies environment values to your defaults and returns a
shared `AppConfig`. It supports MariaDB, SpacetimeDB, media storage, CAPTCHA,
and email settings.
Values can come from environment variables or secret files. Use `DATABASE_URL`
or `DATABASE_URL_FILE` to choose one source. Supplying both returns an error.
`environment::value` reads individual application settings.
`environment::public_url` reads and checks `PUBLIC_URL`.
## Dotenv files
`environment::EnvFiles::load` builds one configuration snapshot for the process.
The base file supplies defaults. Process variables take priority over the base
file. The override file takes priority over both.
Read loaded settings through `environment::value`, `environment::var`, or
`load_app_config`. Loading does not change the OS environment and is safe after
threads have started. Failed loads leave the configuration unchanged.
Load the files once during startup. Repeating the same selection keeps the
existing snapshot. Pass `environment::vars_os()` to `Command::envs` when a child
process needs the loaded settings.
See the [API documentation](https://docs.rs/ch-config) for available settings.
## License
[Sustainable Use License 1.0](LICENSE.md).