File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -60,14 +60,18 @@ where
60
60
// We build the environment configuration source.
61
61
let mut environment_source = config:: Environment :: with_prefix ( ENV_PREFIX )
62
62
. 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
+ }
71
75
}
72
76
73
77
let settings = config:: Config :: builder ( )
You can’t perform that action at this time.
0 commit comments