config-rs icon indicating copy to clipboard operation
config-rs copied to clipboard

UpperCamel Case fails to capitalize first word immediately after a multilevel separator in Environment.

Open dtessman opened this issue 3 months ago • 0 comments

let mut builder = Config::builder()
.add_source(File::with_name(&config_path).format(FileFormat::Json).required(false))              .add_source(Environment::default().prefix("CONFIG").prefix_separator("_").separator("__").convert_case(Case::UpperCamel));

If the file contains:

Otel {
            Endpoint: "FROM FILE"
}

And the environment variable "CONFIG_OTEL__ENDPOINT" equals "FROM ENV"

getting "Otel.Endpoint" will equal "FROM FILE" and "Otel.endpoint" will equal "FROM ENV" rather than the environment overriding the file.

dtessman avatar Sep 20 '25 00:09 dtessman