From bdd43f3f24c28645f109645801e3feeb42492522 Mon Sep 17 00:00:00 2001 From: Goran Date: Wed, 12 Jun 2024 15:43:55 +0200 Subject: [PATCH] feat(configure_instance): check mandatory variables before starting (#4760) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: update self-host guide link in README (#4704) found via: - https://github.com/makeplane/docs/issues/48 - https://github.com/makeplane/plane/pull/3109 * feat(configure_instance): add check for mandatory variables before starting * fix(configure_instance): use correct variable and improve the exception * fix(configure_instance): remove trailling spaces * fix(configure_instance): check the mandatory value from exported env only * fix(configure_instance): remove useless import * fix(configure_command): improve the way error is raising --------- Co-authored-by: jon ⚝ --- README.md | 2 +- .../license/management/commands/configure_instance.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 38ead5f99..e465f3cb1 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Meet [Plane](https://dub.sh/plane-website-readme), an open-source project manage The easiest way to get started with Plane is by creating a [Plane Cloud](https://app.plane.so) account. -If you would like to self-host Plane, please see our [deployment guide](https://docs.plane.so/docker-compose). +If you would like to self-host Plane, please see our [deployment guide](https://docs.plane.so/self-hosting/overview). | Installation methods | Docs link | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | diff --git a/apiserver/plane/license/management/commands/configure_instance.py b/apiserver/plane/license/management/commands/configure_instance.py index 5a6eadc2e..1d4d5fb29 100644 --- a/apiserver/plane/license/management/commands/configure_instance.py +++ b/apiserver/plane/license/management/commands/configure_instance.py @@ -2,7 +2,7 @@ import os # Django imports -from django.core.management.base import BaseCommand +from django.core.management.base import BaseCommand, CommandError # Module imports from plane.license.models import InstanceConfiguration @@ -15,6 +15,12 @@ class Command(BaseCommand): from plane.license.utils.encryption import encrypt_data from plane.license.utils.instance_value import get_configuration_value + mandatory_keys = ["SECRET_KEY"] + + for item in mandatory_keys: + if not os.environ.get(item): + raise CommandError(f"{item} env variable is required.") + config_keys = [ # Authentication Settings {