pub fn read<T>(
app_name: &str,
options: Option<ReadOptions<'_>>,
) -> Result<T, Error>Expand description
Read config from the platform-default config.toml for app_name,
creating the file from T::default() when it does not already exist.
Use ReadOptions to apply environment variable overrides after the file
is loaded.
use cloudiful_config::{ReadOptions, read};
use serde::{Deserialize, Serialize};
#[derive(Default, Deserialize, Serialize)]
struct AppConfig {
port: u16,
}
let _config: AppConfig = read("stock", Some(ReadOptions::with_env_prefix("STOCK_"))).unwrap();