Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions 8Knot/cache_manager/alembic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Alembic config for the Postgres cache schema.
#
# The database URL is NOT set here; env.py builds it from the same
# CACHE_* environment variables as cx_common, so there's one source of
# connection truth. To create a new revision during development:
#
# cd 8Knot/cache_manager
# alembic revision -m "describe change"
#
# (the CACHE_*/AUGUR_* env vars cx_common reads must be set in your shell).
# In production, db_init.py drives "alembic upgrade head" programmatically.

[alembic]
script_location = migrations
prepend_sys_path = .
30 changes: 20 additions & 10 deletions 8Knot/cache_manager/cx_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import logging
import time

from psycopg2.extensions import make_dsn

# credentials to access database from environment
try:
env_augur_user = os.environ["AUGUR_USERNAME"]
Expand All @@ -32,20 +34,28 @@

# purely initial startup string
# psycopg2 connection string for cache pg instance, initialization only
init_cx_string = "dbname={} user={} password={} host={} port={}".format(
"postgres", env_user, env_password, env_host, env_port
init_cx_string = make_dsn(
dbname="postgres",
user=env_user,
password=env_password,
host=env_host,
port=env_port,
)

# psycopg2 connection string for cache pg instance
cache_cx_string = "dbname={} user={} password={} host={} port={}".format(
env_dbname, env_user, env_password, env_host, env_port
cache_cx_string = make_dsn(
dbname=env_dbname,
user=env_user,
password=env_password,
host=env_host,
port=env_port,
)

# psycopg2 connection string for augur db
db_cx_string = "dbname={} user={} password={} host={} port={}".format(
env_augur_database,
env_augur_user,
env_augur_password,
env_augur_host,
env_augur_port,
db_cx_string = make_dsn(
dbname=env_augur_database,
user=env_augur_user,
password=env_augur_password,
host=env_augur_host,
port=env_augur_port,
)
Loading
Loading