mehcode/config-rs

`Err` value: invalid type: string "myfieldvalue", expected a borrowed string' after updating dependencies

Closed this issue · 1 comments

After updating my dependencies the config loader stopped working.

pub fn init_config<'de, T: Deserialize<'de>>() -> Result<T, ConfigError> {
    let env = std::env::var("RUN_MODE").unwrap_or_else(|_| "default".into());

    info!("Using settings from: {}", env);

    ::config::Config::builder()
        .add_source(File::with_name(&format!("config/{env}")).required(true))
        // Add in a local configuration file
        // This file shouldn't be checked in to git
        // s.merge(File::with_name("config/local").required(false))?;
        // Add in settings from the environment (with a prefix of APP)
        // Eg.. `APP_DEBUG=1 ./target/app` would set the `debug` key
        .add_source(
            Environment::with_prefix("APP")
                .separator("__")
                .prefix_separator("_")
                .try_parsing(true),
        )
        // You may also programmatically change settings
        // s.set("database.url", "postgres://")?;
        // Now that we're done, let's access our configuration
        // println!("debug: {:?}", s.get_bool("debug"));
        // You can deserialize (and thus freeze) the entire configuration as
        .build()?
        .try_deserialize()
}

├── config v0.13.3
│   ├── async-trait v0.1.73 (proc-macro) (*)
│   ├── lazy_static v1.4.0
│   ├── nom v7.1.3
│   │   ├── memchr v2.6.3
│   │   └── minimal-lexical v0.2.1
│   ├── pathdiff v0.2.1
│   ├── serde v1.0.188 (*)
│   └── yaml-rust v0.4.5
│       └── linked-hash-map v0.5.6

RUN_MODE=local cargo run --release

I think it is an issue of pantonshire/enumscribe#3