Skip to content

Instantly share code, notes, and snippets.

@ryandotclair
Created November 27, 2015 16:26
Show Gist options
  • Save ryandotclair/ede353378eeb5f6f450b to your computer and use it in GitHub Desktop.
Save ryandotclair/ede353378eeb5f6f450b to your computer and use it in GitHub Desktop.
db info
# Get DB IP info
if os.environ.get('DB_PORT_5432_TCP_ADDR') != None:
db_host = os.environ['DB_PORT_5432_TCP_ADDR']
else:
db_host = os.getenv('SRDBHOST', "localhost")
# Get DB Port info
if os.environ.get('DB_PORT_5432_TCP_PORT') != None:
db_port = os.environ['DB_PORT_5432_TCP_PORT']
else:
db_port = os.getenv('SRDBPORT', "5432")
# Get DB PW info
if os.environ.get('POSTGRES_PASSWORD') != None:
db_pass = os.environ['POSTGRES_PASSWORD']
else:
db_pass = os.getenv('SRDBPASS', "mysupersecretpassword")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment