You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I would like to know if it's actually possible to have this Settings::new return a Ok result
use config::{Config,ConfigError,Environment};use serde::Deserialize;#[derive(Debug,Deserialize)]#[allow(unused)]structAuth{token:String,secret:String,}#[derive(Debug,Deserialize)]#[allow(unused)]pubstructSettings{auths:Vec<Auth>,}implSettings{pubfnnew() -> Result<Self,ConfigError>{let s = Config::builder().add_source(Environment::with_prefix("APP").separator("_").try_parsing(true),).build()?;
s.try_deserialize()}}fnmain(){let settings = Settings::new();// Print out our settingsprintln!("{:?}", settings);}
I was thinking something like APP_AUTHS_0_TOKEN=token APP_AUTHS_0_SECRET=secret cargo run
I found the list_separator method on Environment but I think it's only to manage Vec<String>
Is it something that is currently possible ? If not is it a feature that would make sense to implement or maybe I should use another Source ?
Thanks
The text was updated successfully, but these errors were encountered:
Hello I would like to know if it's actually possible to have this
Settings::new
return a Ok resultI was thinking something like
APP_AUTHS_0_TOKEN=token APP_AUTHS_0_SECRET=secret cargo run
I found the
list_separator
method onEnvironment
but I think it's only to manageVec<String>
Is it something that is currently possible ? If not is it a feature that would make sense to implement or maybe I should use another
Source
?Thanks
The text was updated successfully, but these errors were encountered: