gleamcms/config
Types
Runtime configuration loaded once at boot and threaded through the app.
pub type Config {
Config(
secret: String,
admin_token: String,
output_dir: String,
data_dir: String,
port: Int,
cookie_max_age: Int,
import_legacy: Bool,
)
}
Constructors
-
Config( secret: String, admin_token: String, output_dir: String, data_dir: String, port: Int, cookie_max_age: Int, import_legacy: Bool, )
Values
pub fn admin_enabled(cfg: Config) -> Bool
pub fn admin_token(cfg: Config) -> String
pub fn cookie_max_age(cfg: Config) -> Int
pub fn import_legacy(cfg: Config) -> Bool
pub fn load() -> Result(Config, List(String))
Load and validate all runtime settings from the process environment. Secrets are never included in the returned errors or startup diagnostics.
pub fn load_with(
read_env: fn(String) -> Result(String, Nil),
) -> Result(Config, List(String))
Load configuration from a supplied environment reader. Keeping validation separate from the process environment makes the contract deterministic to test without mutating global process state.
pub fn output_dir(cfg: Config) -> String