Skip to content

Commit 831fd35

Browse files
authored
fix(config): Fix wrong parsing (#310)
1 parent e08be07 commit 831fd35

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

etl-config/src/load.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,18 @@ where
6060
// We build the environment configuration source.
6161
let mut environment_source = config::Environment::with_prefix(ENV_PREFIX)
6262
.prefix_separator(ENV_PREFIX_SEPARATOR)
63-
.separator(ENV_SEPARATOR)
64-
.try_parsing(true)
65-
.list_separator(LIST_SEPARATOR);
66-
67-
// For all the list parse keys, we add them to the environment source. These are used to define
68-
// which keys should be parsed as lists.
69-
for key in <T as Config>::LIST_PARSE_KEYS {
70-
environment_source = environment_source.with_list_parse_key(key);
63+
.separator(ENV_SEPARATOR);
64+
65+
// If there is a list of keys to parse, we add them to the source and enable parsing with the
66+
// separator.
67+
if !<T as Config>::LIST_PARSE_KEYS.is_empty() {
68+
environment_source = environment_source
69+
.try_parsing(true)
70+
.list_separator(LIST_SEPARATOR);
71+
72+
for key in <T as Config>::LIST_PARSE_KEYS {
73+
environment_source = environment_source.with_list_parse_key(key);
74+
}
7175
}
7276

7377
let settings = config::Config::builder()

0 commit comments

Comments
 (0)