Skip to content

Commit

Permalink
bug: set config env separator to double underscore. (#763)
Browse files Browse the repository at this point in the history
Closes #762
Issue #320
  • Loading branch information
jrconlin committed Aug 6, 2020
1 parent 71ab9b3 commit f1d88fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ impl Settings {
}

// Merge the environment overrides
s.merge(Environment::with_prefix(PREFIX))?;
// While the prefix is currently case insensitive, it's traditional that
// environment vars be UPPERCASE, this ensures that will continue should
// Environment ever change their policy about case insensitivity.
// This will accept environment variables specified as
// `SYNC_FOO__BAR_VALUE="gorp"` as `foo.bar_value = "gorp"`
s.merge(Environment::with_prefix(&PREFIX.to_uppercase()).separator("__"))?;

Ok(match s.try_into::<Self>() {
Ok(s) => {
Expand Down
2 changes: 1 addition & 1 deletion src/web/extractors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ impl FromRequest for ConfigRequest {
max_request_bytes: data.max_request_bytes,
max_total_bytes: data.max_total_bytes,
max_total_records: data.max_total_records,
debug_client: None,
debug_client: data.debug_client.clone(),
},
}))
}
Expand Down

0 comments on commit f1d88fe

Please sign in to comment.