diff --git a/caprover_create_app.py b/caprover_create_app.py index d3f2175f..40a62e0f 100644 --- a/caprover_create_app.py +++ b/caprover_create_app.py @@ -74,6 +74,10 @@ def main(app_name, image_name, environment_file): environment_variables={ # 'DJANGO_SETTINGS_MODULE': 'config.settings.base', "VITE_APP_ENVIRONMENT": env.str("VITE_APP_ENVIRONMENT", "dev-feature"), + "VITE_LOGOUT_REDIRECT": env.str( + "VITE_LOGOUT_REDIRECT", + "https://vbvdev.b2clogin.com/vbvdev.onmicrosoft.com/b2c_1_signupandsignin/oauth2/v2.0/logout/?post_logout_redirect_uri=https://vbv-lernwelt.control.iterativ.ch", + ), "IT_DEFAULT_ADMIN_PASSWORD": env.str("fWwoQzreIS5uztLOyF8jJpS9M"), "POSTGRES_HOST": f"srv-captain--{app_name}-postgres", "POSTGRES_PORT": 5432, diff --git a/caprover_deploy.sh b/caprover_deploy.sh index ffdfc2ce..08714662 100755 --- a/caprover_deploy.sh +++ b/caprover_deploy.sh @@ -25,8 +25,6 @@ function generate_default_app_name() { # take app name as first argument or use the default generated app name APP_NAME=${1:-$(generate_default_app_name)} -VITE_SENTRY_ENV="development" - if [[ "$APP_NAME" == "myvbv" ]]; then VITE_LOGOUT_REDIRECT="https://edumgr.b2clogin.com/edumgr.onmicrosoft.com/b2c_1_signupandsignin/oauth2/v2.0/logout/?post_logout_redirect_uri=https://myvbv.iterativ.ch/" VITE_SENTRY_ENV="production" diff --git a/client/src/components/AppFooter.vue b/client/src/components/AppFooter.vue index eb0b6b4f..1223302a 100644 --- a/client/src/components/AppFooter.vue +++ b/client/src/components/AppFooter.vue @@ -8,7 +8,7 @@ import * as log from "loglevel"; log.debug("AppFooter created"); const userStore = useUserStore(); -const hideVersion = import.meta.env.VITE_SENTRY_ENV === "production"; +const hideVersion = import.meta.env.VITE_APP_ENVIRONMENT.startsWith("prod"); async function changeLocale(language: AvailableLanguages) { userStore.setUserLanguages(language); diff --git a/client/src/main.ts b/client/src/main.ts index df15ebee..0e11e50d 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -28,12 +28,12 @@ const app = createApp(App); Sentry.init({ app, - environment: import.meta.env.VITE_SENTRY_ENV || "development", + environment: import.meta.env.VITE_APP_ENVIRONMENT || "local", dsn: "https://2df6096a4fd94bd6b4802124d10e4b8d@o8544.ingest.sentry.io/4504157846372352", tracesSampleRate: 0.0, enabled: - import.meta.env.VITE_SENTRY_ENV == "production" || - import.meta.env.VITE_SENTRY_ENV == "stage", + import.meta.env.VITE_APP_ENVIRONMENT.startsWith("prod") || + import.meta.env.VITE_APP_ENVIRONMENT.startsWith("stage"), }); // todo: define lang setup diff --git a/client/src/router/guards.ts b/client/src/router/guards.ts index 59c4cf7c..6ca8fc14 100644 --- a/client/src/router/guards.ts +++ b/client/src/router/guards.ts @@ -15,8 +15,8 @@ export const updateLoggedIn: NavigationGuard = async () => { export const redirectToLoginIfRequired: NavigationGuard = (to) => { const userStore = useUserStore(); if (loginRequired(to) && !userStore.loggedIn) { - const sentryEnv = import.meta.env.VITE_SENTRY_ENV; - const ssoLogin = sentryEnv === "production" || sentryEnv === "staging"; + const sentryEnv = import.meta.env.VITE_APP_ENVIRONMENT; + const ssoLogin = sentryEnv.startsWith("prod") || sentryEnv.startsWith("stage"); return ssoLogin ? `/login?next=${to.fullPath}` : `/login-local?next=${to.fullPath}`; } }; diff --git a/env_secrets/caprover_dev.env b/env_secrets/caprover_dev.env index 15128702..411d93c8 100644 Binary files a/env_secrets/caprover_dev.env and b/env_secrets/caprover_dev.env differ diff --git a/env_secrets/caprover_prod.env b/env_secrets/caprover_prod.env index 60c3eede..2204b67b 100644 Binary files a/env_secrets/caprover_prod.env and b/env_secrets/caprover_prod.env differ diff --git a/env_secrets/caprover_stage.env b/env_secrets/caprover_stage.env index e6fbd8fd..1faec62f 100644 Binary files a/env_secrets/caprover_stage.env and b/env_secrets/caprover_stage.env differ diff --git a/env_secrets/prod-azure.json b/env_secrets/prod-azure.json new file mode 100644 index 00000000..a150ae74 Binary files /dev/null and b/env_secrets/prod-azure.json differ diff --git a/env_secrets/production.env b/env_secrets/production.env deleted file mode 100644 index 4356f74c..00000000 Binary files a/env_secrets/production.env and /dev/null differ diff --git a/env_secrets/production_azure.json b/env_secrets/production_azure.json deleted file mode 100644 index f7221388..00000000 Binary files a/env_secrets/production_azure.json and /dev/null differ diff --git a/git-crypt-encrypted-files.txt b/git-crypt-encrypted-files.txt index 0825e8e7..565a8b73 100644 --- a/git-crypt-encrypted-files.txt +++ b/git-crypt-encrypted-files.txt @@ -5,6 +5,4 @@ encrypted: env_secrets/local_daniel.env encrypted: env_secrets/local_elia.env encrypted: env_secrets/local_lorenz.env - encrypted: env_secrets/pg_backup_local.env - encrypted: env_secrets/production.env - encrypted: env_secrets/production_azure.json + encrypted: env_secrets/prod-azure.json diff --git a/server/config/settings/base.py b/server/config/settings/base.py index b690a39f..5c6fef66 100644 --- a/server/config/settings/base.py +++ b/server/config/settings/base.py @@ -503,7 +503,7 @@ SPECTACULAR_SETTINGS = { # Your stuff... # ------------------------------------------------------------------------------ -if DEBUG: +if APP_ENVIRONMENT == "local": SECRET_KEY = env( "IT_DJANGO_SECRET_KEY", default="J9FiYN31FuY7lHrmx9Mpai3GGpTVCxakEclOfCLretDe7bTf2DtTsgazJ0aIMtbq",