add DATABASE_HOST config parameter

This commit is contained in:
Trent Palmer 2021-01-13 23:47:32 -08:00
parent 9885d3190c
commit c2ccb01aab
6 changed files with 9 additions and 8 deletions

View File

@ -8,7 +8,7 @@ def delete_photo(photo, app_config):
conn = psycopg2.connect( conn = psycopg2.connect(
dbname=app_config['DATABASE_NAME'], dbname=app_config['DATABASE_NAME'],
user=app_config['DATABASE_USER'], user=app_config['DATABASE_USER'],
host="/var/run/postgresql", host=app_config['DATABASE_HOST'],
password=app_config['DATABASE_PASSWORD'] password=app_config['DATABASE_PASSWORD']
) )
cur = conn.cursor() cur = conn.cursor()

View File

@ -9,7 +9,7 @@ def find_next_previous(photo, app_config):
conn = psycopg2.connect( conn = psycopg2.connect(
dbname=app_config['DATABASE_NAME'], dbname=app_config['DATABASE_NAME'],
user=app_config['DATABASE_USER'], user=app_config['DATABASE_USER'],
host="/var/run/postgresql", host=app_config['DATABASE_HOST'],
password=app_config['DATABASE_PASSWORD'] password=app_config['DATABASE_PASSWORD']
) )
cur = conn.cursor() cur = conn.cursor()
@ -59,7 +59,7 @@ def get_photo_list(contributor_id, app_config):
conn = psycopg2.connect( conn = psycopg2.connect(
dbname=app_config['DATABASE_NAME'], dbname=app_config['DATABASE_NAME'],
user=app_config['DATABASE_USER'], user=app_config['DATABASE_USER'],
host="/var/run/postgresql", host=app_config['DATABASE_HOST'],
password=app_config['DATABASE_PASSWORD'] password=app_config['DATABASE_PASSWORD']
) )
cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor) cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)

View File

@ -13,7 +13,7 @@ def process_uploaded_photo(filename, current_user, app_config):
conn = psycopg2.connect( conn = psycopg2.connect(
dbname=app_config['DATABASE_NAME'], dbname=app_config['DATABASE_NAME'],
user=app_config['DATABASE_USER'], user=app_config['DATABASE_USER'],
host="/var/run/postgresql", host=app_config['DATABASE_HOST'],
password=app_config['DATABASE_PASSWORD'] password=app_config['DATABASE_PASSWORD']
) )
cur = conn.cursor() cur = conn.cursor()

View File

@ -7,7 +7,7 @@ def set_contributor_id_seq(app_config):
conn = psycopg2.connect( conn = psycopg2.connect(
dbname=app_config['DATABASE_NAME'], dbname=app_config['DATABASE_NAME'],
user=app_config['DATABASE_USER'], user=app_config['DATABASE_USER'],
host="/var/run/postgresql", host=app_config['DATABASE_HOST'],
password=app_config['DATABASE_PASSWORD'] password=app_config['DATABASE_PASSWORD']
) )

View File

@ -13,7 +13,7 @@ def get_totp_qr(contributor, app_config):
conn = psycopg2.connect( conn = psycopg2.connect(
dbname=app_config['DATABASE_NAME'], dbname=app_config['DATABASE_NAME'],
user=app_config['DATABASE_USER'], user=app_config['DATABASE_USER'],
host="/var/run/postgresql", host=app_config['DATABASE_HOST'],
password=app_config['DATABASE_PASSWORD'] password=app_config['DATABASE_PASSWORD']
) )
cur = conn.cursor() cur = conn.cursor()
@ -33,7 +33,7 @@ def validate_totp(contributor, totp_code, app_config):
conn = psycopg2.connect( conn = psycopg2.connect(
dbname=app_config['DATABASE_NAME'], dbname=app_config['DATABASE_NAME'],
user=app_config['DATABASE_USER'], user=app_config['DATABASE_USER'],
host="/var/run/postgresql", host=app_config['DATABASE_HOST'],
password=app_config['DATABASE_PASSWORD'] password=app_config['DATABASE_PASSWORD']
) )
cur = conn.cursor() cur = conn.cursor()
@ -49,7 +49,7 @@ def disable_2fa(contributor, app_config):
conn = psycopg2.connect( conn = psycopg2.connect(
dbname=app_config['DATABASE_NAME'], dbname=app_config['DATABASE_NAME'],
user=app_config['DATABASE_USER'], user=app_config['DATABASE_USER'],
host="/var/run/postgresql", host=app_config['DATABASE_HOST'],
password=app_config['DATABASE_PASSWORD'] password=app_config['DATABASE_PASSWORD']
) )
cur = conn.cursor() cur = conn.cursor()

View File

@ -14,6 +14,7 @@ class Config(object):
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False
DATABASE_NAME = os.environ.get('DATABASE_NAME') DATABASE_NAME = os.environ.get('DATABASE_NAME')
DATABASE_USER = os.environ.get('DATABASE_USER') DATABASE_USER = os.environ.get('DATABASE_USER')
DATABASE_HOST = os.environ.get('DATABASE_HOST')
DATABASE_PASSWORD = os.environ.get('DATABASE_PASSWORD') DATABASE_PASSWORD = os.environ.get('DATABASE_PASSWORD')
LOGGING_XMPP_SERVER = os.environ.get('LOGGING_XMPP_SERVER') LOGGING_XMPP_SERVER = os.environ.get('LOGGING_XMPP_SERVER')