diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7ed2cf5..05a0d31 100644 --- a/.gitlab-ci.yml +++ b/.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: diff --git a/lemoncurry/settings/base.py b/lemoncurry/settings/base.py index 25a4bd2..911f2b2 100644 --- a/lemoncurry/settings/base.py +++ b/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 } }