Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Commit

Permalink
Adds array support for configuration file. Now you can define array v…
Browse files Browse the repository at this point in the history
…ariables in conf file with env variables.
  • Loading branch information
KardanovIR committed Sep 24, 2018
1 parent 76d96e0 commit 7a647b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion starter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import math
from tqdm import tqdm
import ipaddress
import ast

DEFAULT_VERSION = 'latest'
DEFAULT_AUTODETECT = 'yes'
Expand Down Expand Up @@ -51,7 +52,11 @@ def parse_env_variables():
if "__" in env_key:
parts = env_key.split('__')
keys = [x.lower().replace('_', '-') for x in parts]
nested_set(dictionary, keys, os.environ[env_key])
value = os.environ[env_key]
if isinstance(value, str) and len(value) > 0 and value[0] == '[' and value[-1] == ']':
print(value)
value = ast.literal_eval(value)
nested_set(dictionary, keys, value)
return dictionary


Expand Down

0 comments on commit 7a647b7

Please sign in to comment.