-
-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
figment can automatically get names of expected environment variables. With the following config:
#[derive(Deserialize, Debug, Clone, Serialize)]
pub struct OpenlibraryConfig {
pub url: String
}
#[derive(Deserialize, Debug, Clone, Serialize)]
pub struct BookConfig {
pub openlibrary: OpenlibraryConfig
}
#[derive(Deserialize, Debug, Clone)]
pub struct AppConfig {
#[serde(default)]
book: BookConfig
}
let conf: AppConfig = Figment::new().merge(Env::raw().split("_")).extract()?;The above configuration expects BOOK_OPENLIBRARY_URL, without me having to manually annotate it in the struct. Would be nice if confique supported it as well.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels