Configuration
Configuration is data
Every value below is typed and read at startup. The framework sections start from their defaults, then `.env`, then the files in src/config/.
| APP_NAME | dust demo |
|---|---|
| APP_ENV | production |
| APP_DEBUG | false |
| APP_URL | https://demo.dustapp.dev |
| SESSION_DRIVER | Memory |
| SESSION_LIFETIME | 2h |
| CACHE_STORE | memory |
| CACHE_PREFIX | dust_demo_cache_ |
| QUEUE_CONNECTION | sync |
| MAIL_MAILER | log |
| MAIL_FROM_ADDRESS | hello@example.com |
| CORS_CREDENTIALS | false |
| CORS_ALLOWED_ORIGINS | Only(["https://demo.dustapp.dev", "https://dustapp.dev"]) |
The demo's own section
Unlike the framework sections, this one belongs to the application. It is declared in src/config/services.rs and arrives in the handler as Section<Demo>.
| DEMO_GREETING | Configuration is data |
|---|---|
| DEMO_SIGNATURE | the dust demo |
| DEMO_CACHE_TTL | 1m 30s |
The section
#[derive(Clone, Debug, Section)]
pub struct Demo {
#[env("DEMO_GREETING", default = "Hello from a configuration file")]
pub greeting: String,
#[env("DEMO_SIGNATURE", default = "the dust demo")]
pub signature: String,
#[env("DEMO_CACHE_TTL", seconds, default = 60)]
pub cache_ttl: ExactDuration,
}Change a value in .env or in the environment, restart, and the page shows the new one. The configuration guide covers the precedence and the fields.