Skip to content

Commit

Permalink
[CONF] Default values for postgres variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dameyerdave committed Dec 7, 2023
1 parent 67c4d8d commit 5587ab3
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions api/app/ena_upload_ms/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"HOST": environ.get("POSTGRES_HOST"),
"PORT": environ.get("POSTGRES_PORT"),
"NAME": environ.get("POSTGRES_DB"),
"USER": environ.get("POSTGRES_USER"),
"HOST": environ.get("POSTGRES_HOST", "db"),
"PORT": environ.get("POSTGRES_PORT", "5432"),
"NAME": environ.get("POSTGRES_DB", "ena"),
"USER": environ.get("POSTGRES_USER", "ena"),
"PASSWORD": environ.get("POSTGRES_PASSWORD"),
}
}
Expand Down Expand Up @@ -181,8 +181,12 @@
ALLOWED_HOSTS = environ.get("DJANGO_ALLOWED_HOSTS", "*").split(",")

# CORS configuration
CORS_ALLOW_ALL_ORIGINS = True
CORS_ALLOWED_ORIGINS = environ.get("DJANGO_CORS_ALLOWED_ORIGINS", "").split(",")
CORS_ALLOW_ALL_ORIGINS = False if environ.get("DJANGO_CORS_ALLOWED_ORIGINS") else True
CORS_ALLOWED_ORIGINS = (
environ.get("DJANGO_CORS_ALLOWED_ORIGINS").split(",")
if environ.get("DJANGO_CORS_ALLOWED_ORIGINS")
else None
)
CORS_ALLOW_HEADERS = default_headers + (
"cache-control",
"pragma",
Expand All @@ -192,7 +196,11 @@
CORS_ALLOW_CREDENTIALS = True

# CSRF configuration
CSRF_TRUSTED_ORIGINS = environ.get("DJANGO_CSRF_TRUSTED_ORIGINS", "").split(",")
CSRF_TRUSTED_ORIGINS = (
environ.get("DJANGO_CSRF_TRUSTED_ORIGINS").split(",")
if environ.get("DJANGO_CSRF_TRUSTED_ORIGINS")
else None
)
CSRF_USE_SESSIONS = False
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_SAMESITE = "Strict"
Expand Down

0 comments on commit 5587ab3

Please sign in to comment.