Refactor POSTGRES_HOST env

This commit is contained in:
Nikita P. Shupeyko 2018-05-09 12:49:39 +03:00
parent b4b3c04253
commit 906299ae39
6 changed files with 7 additions and 4 deletions

View File

@ -115,6 +115,7 @@ Consider the aforementioned ``.envs/.local/.postgres``: ::
# PostgreSQL
# ------------------------------------------------------------------------------
POSTGRES_HOST=postgres
POSTGRES_DB=<your project slug>
POSTGRES_USER=XgOWtQtJecsAbaIyslwGvFvPawftNaqO
POSTGRES_PASSWORD=jSljDz4whHuwO3aJIgVBrqEml5Ycbghorep4uVJ4xjDYQu0LfuTZdctj7y0YcCLu

View File

@ -1,5 +1,6 @@
# PostgreSQL
# ------------------------------------------------------------------------------
POSTGRES_HOST=postgres
POSTGRES_DB={{ cookiecutter.project_slug }}
POSTGRES_USER=!!!SET POSTGRES_USER!!!
POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!!

View File

@ -1,5 +1,6 @@
# PostgreSQL
# ------------------------------------------------------------------------------
POSTGRES_HOST=postgres
POSTGRES_DB={{ cookiecutter.project_slug }}
POSTGRES_USER=!!!SET POSTGRES_USER!!!
POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!!

View File

@ -14,7 +14,7 @@ if [ -z "${POSTGRES_USER}" ]; then
base_postgres_image_default_user='postgres'
export POSTGRES_USER="${base_postgres_image_default_user}"
fi
export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}"
export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}"
postgres_ready() {
python << END
@ -27,7 +27,7 @@ try:
dbname="${POSTGRES_DB}",
user="${POSTGRES_USER}",
password="${POSTGRES_PASSWORD}",
host="postgres"
host="${POSTGRES_HOST}"
)
except psycopg2.OperationalError:
sys.exit(-1)

View File

@ -25,7 +25,7 @@ if [[ "${POSTGRES_USER}" == "postgres" ]]; then
exit 1
fi
export PGHOST="postgres"
export PGHOST="${POSTGRES_HOST}"
export PGUSER="${POSTGRES_USER}"
export PGPASSWORD="${POSTGRES_PASSWORD}"
export PGDATABASE="${POSTGRES_DB}"

View File

@ -37,7 +37,7 @@ if [[ "${POSTGRES_USER}" == "postgres" ]]; then
exit 1
fi
export PGHOST="postgres"
export PGHOST="${POSTGRES_HOST}"
export PGUSER="${POSTGRES_USER}"
export PGPASSWORD="${POSTGRES_PASSWORD}"
export PGDATABASE="${POSTGRES_DB}"