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 eab15e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 6 additions & 3 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
},
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',
'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),
}
}

Expand Down

0 comments on commit eab15e1

Please sign in to comment.