Skip to content

Commit

Permalink
Merge pull request #200 from devcurmudgeon/allow-environment-variables
Browse files Browse the repository at this point in the history
Allow environment variables
  • Loading branch information
devcurmudgeon committed Mar 25, 2016
2 parents c84b653 + bf8dba5 commit 709618a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ script:
- cd ..
- git clone git://git.baserock.org/baserock/baserock/definitions
- cd definitions
- export YBD_mode=keys-only
- ../ybd/ybd.py ci x86_64
7 changes: 7 additions & 0 deletions ybd/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,15 @@ def setup(args):
# Suppress multiple instances of the same warning.
warnings.simplefilter('once', append=True)

# dump any applicable environment variables into a config file
with open('./ybd.environment', 'w') as f:
for key in os.environ:
if key[:4] == "YBD_":
f.write(key[4:] + ": " + os.environ.get(key) + '\n')

# load config files in reverse order of precedence
load_configs([
os.path.join(os.getcwd(), 'ybd.environment'),
os.path.join(os.getcwd(), 'ybd.conf'),
os.path.join(os.path.dirname(__file__), '..', 'ybd.conf'),
os.path.join(os.path.dirname(__file__), 'config', 'ybd.conf')])
Expand Down

0 comments on commit 709618a

Please sign in to comment.