Skip to content

Commit

Permalink
settings: Add CI defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Dec 10, 2023
1 parent 7b18cc1 commit 85bda7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
12 changes: 8 additions & 4 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@
from django.conf import settings

if not settings.configured:
ci = os.getenv('CI', False)

settings.configure(
SECRET_KEY='x',
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 '',
'HOST': 'localhost',
'NAME': 'postgres' if ci else 'represent_boundaries_test',
'USER': 'postgres' if ci else '',
'PASSWORD': 'postgres' if ci else '',
'PORT': os.getenv('PORT', 5432),
}
},
ROOT_URLCONF='boundaries.urls',
INSTALLED_APPS=(
'django.contrib.admin',
'django.contrib.auth',
Expand Down Expand Up @@ -45,6 +48,7 @@
},
},
],
ROOT_URLCONF='boundaries.urls',
)
django.setup()

Expand Down
8 changes: 7 additions & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
'HOST': 'localhost',
'NAME': 'postgres' if ci else 'represent_boundaries',
'USER': 'postgres' if ci else '',
'PASSWORD': 'postgres' if ci else '',
'PORT': os.getenv('PORT', 5432),
}
}

Expand Down

0 comments on commit 85bda7a

Please sign in to comment.