chore: database configuration (#2497)

This commit is contained in:
Nikhil 2023-10-27 15:34:01 +05:30 committed by GitHub
parent 6bebb8a93b
commit 4e86110123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,19 +14,21 @@ from .common import * # noqa
# Database # Database
DEBUG = int(os.environ.get("DEBUG", 0)) == 1 DEBUG = int(os.environ.get("DEBUG", 0)) == 1
if bool(os.environ.get("DATABASE_URL")):
# Parse database configuration from $DATABASE_URL
DATABASES["default"] = dj_database_url.config()
else:
DATABASES = { DATABASES = {
"default": { "default": {
"ENGINE": "django.db.backends.postgresql", "ENGINE": "django.db.backends.postgresql",
"NAME": "plane", "NAME": os.environ.get("POSTGRES_DB"),
"USER": os.environ.get("PGUSER", ""), "USER": os.environ.get("POSTGRES_USER"),
"PASSWORD": os.environ.get("PGPASSWORD", ""), "PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
"HOST": os.environ.get("PGHOST", ""), "HOST": os.environ.get("POSTGRES_HOST"),
} }
} }
# Parse database configuration from $DATABASE_URL
DATABASES["default"] = dj_database_url.config()
SITE_ID = 1 SITE_ID = 1
# Set the variable true if running in docker environment # Set the variable true if running in docker environment
@ -278,4 +280,3 @@ SCOUT_NAME = "Plane"
# Unsplash Access key # Unsplash Access key
UNSPLASH_ACCESS_KEY = os.environ.get("UNSPLASH_ACCESS_KEY") UNSPLASH_ACCESS_KEY = os.environ.get("UNSPLASH_ACCESS_KEY")