mehcode / config-rs

⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Apache License 2.0
2.43k stars 206 forks source link

Can't parse an empty array with the env parser #443

Open gurinderu opened 11 months ago

gurinderu commented 11 months ago

I am trying to parse a vec key with Env (with env TEST_KEY__LIST = "") source like

Environment::with_prefix("TEST")
        .try_parsing(true)
        .prefix_separator("_")
        .separator("__")
        .list_separator(",")
        .with_list_parse_key("test_key.enable")
struct Config {
  test_key: TestKey
}

enum Test {
  One,
  Two
}

struct TestKey {
  enable: Vec<Test>
}

and I see

invalid type: string "", expected a sequence

I assume that the empty string should be parsed as an empty array