Skip to content

Instantly share code, notes, and snippets.

@foxx
Last active January 15, 2016 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foxx/632dae63b566acb76a2e to your computer and use it in GitHub Desktop.
Save foxx/632dae63b566acb76a2e to your computer and use it in GitHub Desktop.
blog
for k in ['host', 'port', 'database', 'user', 'password']:
if k in dbconfig:
if type(dbconfig[k]) in (str, unicode):
match = pat.match(dbconfig[k])
if match and match.groups():
envvar = match.groups()[0]
if envvar in os.environ:
dbconfig[k] = os.environ[envvar]
if k != 'password':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment