From 0c3635cf25ef5f623bbd6300712979aa7d5578ca Mon Sep 17 00:00:00 2001 From: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com> Date: Tue, 20 Jun 2023 09:36:08 +0530 Subject: [PATCH] chore: added DEBUG value for docker setup (#1327) * chore: add DEBUG value for docker setup * refactor: removed the extra DEFAULT value --- .env.example | 3 +++ apiserver/plane/settings/local.py | 4 +++- apiserver/plane/settings/production.py | 5 ++++- apiserver/plane/settings/staging.py | 4 +++- docker-compose-hub.yml | 2 ++ docker-compose.yml | 2 ++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index f8c15a1cb..166fbb9b7 100644 --- a/.env.example +++ b/.env.example @@ -22,6 +22,9 @@ NEXT_PUBLIC_SLACK_CLIENT_ID="" # Backend +# Debug value for api server use it as 0 for production use +DEBUG=0 + # Database Settings PGUSER="plane" PGPASSWORD="plane" diff --git a/apiserver/plane/settings/local.py b/apiserver/plane/settings/local.py index c7d8b1bdf..1b862c013 100644 --- a/apiserver/plane/settings/local.py +++ b/apiserver/plane/settings/local.py @@ -10,7 +10,9 @@ from sentry_sdk.integrations.redis import RedisIntegration from .common import * # noqa -DEBUG = True +DEBUG = int(os.environ.get( + "DEBUG", 1 +)) == 1 EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" diff --git a/apiserver/plane/settings/production.py b/apiserver/plane/settings/production.py index d5fcd3d04..29b75fc8b 100644 --- a/apiserver/plane/settings/production.py +++ b/apiserver/plane/settings/production.py @@ -13,7 +13,10 @@ from sentry_sdk.integrations.redis import RedisIntegration from .common import * # noqa # Database -DEBUG = False +DEBUG = int(os.environ.get( + "DEBUG", 0 +)) == 1 + DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql_psycopg2", diff --git a/apiserver/plane/settings/staging.py b/apiserver/plane/settings/staging.py index 2dab632f1..11ff7a372 100644 --- a/apiserver/plane/settings/staging.py +++ b/apiserver/plane/settings/staging.py @@ -12,7 +12,9 @@ from sentry_sdk.integrations.redis import RedisIntegration from .common import * # noqa # Database -DEBUG = True +DEBUG = int(os.environ.get( + "DEBUG", 1 +)) == 1 DATABASES = { "default": { "ENGINE": "django.db.backends.postgresql_psycopg2", diff --git a/docker-compose-hub.yml b/docker-compose-hub.yml index bc476a6b1..8087bd427 100644 --- a/docker-compose-hub.yml +++ b/docker-compose-hub.yml @@ -52,6 +52,7 @@ services: DEFAULT_EMAIL: ${DEFAULT_EMAIL} DEFAULT_PASSWORD: ${DEFAULT_PASSWORD} USE_MINIO: ${USE_MINIO} + DEBUG: ${DEBUG} depends_on: - plane-db - plane-redis @@ -88,6 +89,7 @@ services: DEFAULT_EMAIL: ${DEFAULT_EMAIL} DEFAULT_PASSWORD: ${DEFAULT_PASSWORD} USE_MINIO: ${USE_MINIO} + DEBUG: ${DEBUG} depends_on: - plane-api - plane-db diff --git a/docker-compose.yml b/docker-compose.yml index df8c239e2..bacfe5cb2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,6 +37,7 @@ services: env_file: - .env environment: + DEBUG: ${DEBUG} DJANGO_SETTINGS_MODULE: plane.settings.production DATABASE_URL: postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:5432/${PGDATABASE} REDIS_URL: redis://plane-redis:6379/ @@ -78,6 +79,7 @@ services: env_file: - .env environment: + DEBUG: ${DEBUG} DJANGO_SETTINGS_MODULE: plane.settings.production DATABASE_URL: postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:5432/${PGDATABASE} REDIS_URL: redis://plane-redis:6379/