Browse Source

Load Postgres parameters from the environment so that it can work with GitLab CI

pull/1/head
Danielle McLean 3 years ago
parent
commit
4c0be4ce8b
  1. 6
      .gitlab-ci.yml
  2. 7
      lemoncurry/settings/base.py

6
.gitlab-ci.yml

@ -1,8 +1,14 @@
image: python:3.6
services:
- postgres:latest
variables:
GIT_SUBMODULE_STRATEGY: normal
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
PIPENV_CACHE_DIR: $CI_PROJECT_DIR/.cache/pipenv
POSTGRES_HOST: postgres
POSTGRES_DB: nice_marmot
POSTGRES_USER: runner
POSTGRES_PASSWORD: ''
cache:
paths:

7
lemoncurry/settings/base.py

@ -10,7 +10,7 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
from os import path
from os import environ, path
from typing import List
APPEND_SLASH = False
@ -170,7 +170,10 @@ CACHES = {
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'lemoncurry',
'NAME': environ.get('POSTGRES_DB', 'lemoncurry'),
'USER': environ.get('POSTGRES_USER'),
'PASSWORD': environ.get('POSTGRES_PASSWORD'),
'HOST': environ.get('POSTGRES_HOST', 'localhost'),
'CONN_MAX_AGE': 3600
}
}

Loading…
Cancel
Save