Skip to content

Commit e2c7792

Browse files
author
Andy Khramtsov
committed
docs: document default environment separator
1 parent 49ead71 commit e2c7792

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/env.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ use crate::ConfigError;
1414
/// config Value type. We have to be aware how the config tree is created from the environment
1515
/// dictionary, therefore we are mindful about prefixes for the environment keys, level separators,
1616
/// encoding form (kebab, snake case) etc.
17+
///
18+
/// For prefixes take a look at [`with_prefix`](Environment::with_prefix()).
19+
/// For level separators take a look at [`separator`](Environment::separator()).
1720
#[must_use]
1821
#[derive(Clone, Debug, Default)]
1922
pub struct Environment {
@@ -35,6 +38,9 @@ pub struct Environment {
3538
/// Optional character sequence that separates each key segment in an environment key pattern.
3639
/// Consider a nested configuration such as `redis.password`, a separator of `_` would allow
3740
/// an environment key of `REDIS_PASSWORD` to match.
41+
///
42+
/// If unset, `.` (a dot) is used. In such case `REDIS.PASSWORD` would be the correct key
43+
/// for the example above.
3844
separator: Option<String>,
3945

4046
/// Optional directive to translate collected keys into a form that matches what serializers
@@ -139,6 +145,9 @@ impl Environment {
139145
/// Optional character sequence that separates each key segment in an environment key pattern.
140146
/// Consider a nested configuration such as `redis.password`, a separator of `_` would allow
141147
/// an environment key of `REDIS_PASSWORD` to match.
148+
///
149+
/// If unset, `.` (a dot) is used. In such case `REDIS.PASSWORD` would be the correct key
150+
/// for the example above.
142151
pub fn separator(mut self, s: &str) -> Self {
143152
self.separator = Some(s.into());
144153
self

0 commit comments

Comments
 (0)