From eab15e1d3126188c29e940c15938ad5e09406bc4 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Sun, 10 Dec 2023 02:33:01 -0500 Subject: [PATCH] settings: Add CI defaults --- runtests.py | 9 ++++++--- settings.py | 8 +++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/runtests.py b/runtests.py index 2e665c4..f6807fa 100644 --- a/runtests.py +++ b/runtests.py @@ -5,13 +5,16 @@ from django.conf import settings if not settings.configured: + ci = os.getenv('CI', False) + settings.configure( DATABASES={ 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': 'postgres' if os.getenv('CI', False) else 'represent_boundaries_test', - 'USER': 'postgres' if os.getenv('CI', False) else '', - 'PASSWORD': 'postgres' if os.getenv('CI', False) else '', + 'NAME': 'postgres' if ci else 'represent_boundaries_test', + 'HOST': 'postgres' if ci else 'localhost', + 'USER': 'postgres' if ci else '', + 'PASSWORD': 'postgres' if ci else '', 'PORT': os.getenv('PORT', 5432), } }, diff --git a/settings.py b/settings.py index 2f258ef..403f35c 100644 --- a/settings.py +++ b/settings.py @@ -3,12 +3,18 @@ """ import os +ci = os.getenv('CI', False) + SECRET_KEY = 'x' DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', - 'NAME': 'represent_boundaries', + 'NAME': 'postgres' if ci else 'represent_boundaries', + 'HOST': 'postgres' if ci else 'localhost', + 'USER': 'postgres' if ci else '', + 'PASSWORD': 'postgres' if ci else '', + 'PORT': os.getenv('PORT', 5432), } }