From 73f6b7fa094ea423cd64f2a92a8bd6ce729475e4 Mon Sep 17 00:00:00 2001 From: Philipp Melab Date: Sat, 13 Apr 2024 09:41:02 +0200 Subject: [PATCH] refactor: improve lagoon environment variables Generic default variables that work with stock hostnames and specifics for dev/stage/prod that allow custom domains. --- apps/cms/.lagoon.env | 6 +++--- apps/cms/.lagoon.env.prod | 7 +++++++ apps/cms/.lagoon.env.stage | 7 +++++++ apps/cms/lagoon.env.dev | 7 +++++++ apps/preview/.lagoon.env | 2 +- apps/preview/.lagoon.env.dev | 1 + apps/preview/.lagoon.env.prod | 1 + apps/preview/.lagoon.env.stage | 1 + apps/website/.lagoon.env | 4 ++-- apps/website/.lagoon.env.dev | 28 ++++++++++++++++++++++++++++ apps/website/.lagoon.env.prod | 28 ++++++++++++++++++++++++++++ apps/website/.lagoon.env.stage | 28 ++++++++++++++++++++++++++++ 12 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 apps/cms/.lagoon.env.prod create mode 100644 apps/cms/.lagoon.env.stage create mode 100644 apps/cms/lagoon.env.dev create mode 100644 apps/preview/.lagoon.env.dev create mode 100644 apps/preview/.lagoon.env.prod create mode 100644 apps/preview/.lagoon.env.stage create mode 100644 apps/website/.lagoon.env.dev create mode 100644 apps/website/.lagoon.env.prod create mode 100644 apps/website/.lagoon.env.stage diff --git a/apps/cms/.lagoon.env b/apps/cms/.lagoon.env index 0309eb662..ed7135291 100644 --- a/apps/cms/.lagoon.env +++ b/apps/cms/.lagoon.env @@ -1,7 +1,7 @@ PROJECT_NAME=example -PUBLISHER_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.build.amazeelabs.dev" -NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" -PREVIEW_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.preview.amazeelabs.dev" +PUBLISHER_URL="https://build.${LAGOON_ENVIRONMENT}.${PROJECT_NAME}.ch4.amazee.io" +NETLIFY_URL="https://build.${LAGOON_ENVIRONMENT}.${PROJECT_NAME}.ch4.amazee.io" +PREVIEW_URL="https://preview.${LAGOON_ENVIRONMENT}.${PROJECT_NAME}.ch4.amazee.io" # Used to set the original client secret. PUBLISHER_OAUTH2_CLIENT_SECRET=REPLACE_ME diff --git a/apps/cms/.lagoon.env.prod b/apps/cms/.lagoon.env.prod new file mode 100644 index 000000000..0309eb662 --- /dev/null +++ b/apps/cms/.lagoon.env.prod @@ -0,0 +1,7 @@ +PROJECT_NAME=example +PUBLISHER_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.build.amazeelabs.dev" +NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" +PREVIEW_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.preview.amazeelabs.dev" + +# Used to set the original client secret. +PUBLISHER_OAUTH2_CLIENT_SECRET=REPLACE_ME diff --git a/apps/cms/.lagoon.env.stage b/apps/cms/.lagoon.env.stage new file mode 100644 index 000000000..0309eb662 --- /dev/null +++ b/apps/cms/.lagoon.env.stage @@ -0,0 +1,7 @@ +PROJECT_NAME=example +PUBLISHER_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.build.amazeelabs.dev" +NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" +PREVIEW_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.preview.amazeelabs.dev" + +# Used to set the original client secret. +PUBLISHER_OAUTH2_CLIENT_SECRET=REPLACE_ME diff --git a/apps/cms/lagoon.env.dev b/apps/cms/lagoon.env.dev new file mode 100644 index 000000000..0309eb662 --- /dev/null +++ b/apps/cms/lagoon.env.dev @@ -0,0 +1,7 @@ +PROJECT_NAME=example +PUBLISHER_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.build.amazeelabs.dev" +NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" +PREVIEW_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.preview.amazeelabs.dev" + +# Used to set the original client secret. +PUBLISHER_OAUTH2_CLIENT_SECRET=REPLACE_ME diff --git a/apps/preview/.lagoon.env b/apps/preview/.lagoon.env index 2c80dc9c1..3f5c6a87b 100644 --- a/apps/preview/.lagoon.env +++ b/apps/preview/.lagoon.env @@ -1 +1 @@ -DRUPAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev" +DRUPAL_URL="https://nginx.${LAGOON_ENVIRONMENT}.${PROJECT_NAME}.ch4.amazee.io" diff --git a/apps/preview/.lagoon.env.dev b/apps/preview/.lagoon.env.dev new file mode 100644 index 000000000..2c80dc9c1 --- /dev/null +++ b/apps/preview/.lagoon.env.dev @@ -0,0 +1 @@ +DRUPAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev" diff --git a/apps/preview/.lagoon.env.prod b/apps/preview/.lagoon.env.prod new file mode 100644 index 000000000..2c80dc9c1 --- /dev/null +++ b/apps/preview/.lagoon.env.prod @@ -0,0 +1 @@ +DRUPAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev" diff --git a/apps/preview/.lagoon.env.stage b/apps/preview/.lagoon.env.stage new file mode 100644 index 000000000..2c80dc9c1 --- /dev/null +++ b/apps/preview/.lagoon.env.stage @@ -0,0 +1 @@ +DRUPAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev" diff --git a/apps/website/.lagoon.env b/apps/website/.lagoon.env index 89379ad89..ba59e9372 100644 --- a/apps/website/.lagoon.env +++ b/apps/website/.lagoon.env @@ -1,7 +1,7 @@ PROJECT_NAME=example DRUPAL_INTERNAL_URL="http://nginx:8080" -DRUPAL_EXTERNAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev" -NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" +DRUPAL_EXTERNAL_URL="https://nginx.${LAGOON_ENVIRONMENT}.${PROJECT_NAME}.ch4.amazee.io" +NETLIFY_URL="https://build.${LAGOON_ENVIRONMENT}.${PROJECT_NAME}.ch4.amazee.io" # ----------------------------------------------- # Publisher authentication with Drupal (OAuth2). diff --git a/apps/website/.lagoon.env.dev b/apps/website/.lagoon.env.dev new file mode 100644 index 000000000..89379ad89 --- /dev/null +++ b/apps/website/.lagoon.env.dev @@ -0,0 +1,28 @@ +PROJECT_NAME=example +DRUPAL_INTERNAL_URL="http://nginx:8080" +DRUPAL_EXTERNAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev" +NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" + +# ----------------------------------------------- +# Publisher authentication with Drupal (OAuth2). +# See main ./README.md for more information. +# ----------------------------------------------- +# Set to true to fully skip authentication. +PUBLISHER_SKIP_AUTHENTICATION=false + +# Secret from the Drupal Publisher Consumer. +PUBLISHER_OAUTH2_CLIENT_SECRET=REPLACE_ME + +# Client id from the Drupal Publisher Consumer. +PUBLISHER_OAUTH2_CLIENT_ID=publisher + +# A random string, used to encrypt the session. +PUBLISHER_OAUTH2_SESSION_SECRET=REPLACE_ME + +# "development" or "production", production will trust first proxy +# and serve secure cookies. +PUBLISHER_OAUTH2_ENVIRONMENT_TYPE=production + +# DRUPAL_EXTERNAL_URL is used by default, but can be overridden +# to match the Drupal production url, without the nginx prefix. +PUBLISHER_OAUTH2_TOKEN_HOST="${DRUPAL_EXTERNAL_URL}" diff --git a/apps/website/.lagoon.env.prod b/apps/website/.lagoon.env.prod new file mode 100644 index 000000000..89379ad89 --- /dev/null +++ b/apps/website/.lagoon.env.prod @@ -0,0 +1,28 @@ +PROJECT_NAME=example +DRUPAL_INTERNAL_URL="http://nginx:8080" +DRUPAL_EXTERNAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev" +NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" + +# ----------------------------------------------- +# Publisher authentication with Drupal (OAuth2). +# See main ./README.md for more information. +# ----------------------------------------------- +# Set to true to fully skip authentication. +PUBLISHER_SKIP_AUTHENTICATION=false + +# Secret from the Drupal Publisher Consumer. +PUBLISHER_OAUTH2_CLIENT_SECRET=REPLACE_ME + +# Client id from the Drupal Publisher Consumer. +PUBLISHER_OAUTH2_CLIENT_ID=publisher + +# A random string, used to encrypt the session. +PUBLISHER_OAUTH2_SESSION_SECRET=REPLACE_ME + +# "development" or "production", production will trust first proxy +# and serve secure cookies. +PUBLISHER_OAUTH2_ENVIRONMENT_TYPE=production + +# DRUPAL_EXTERNAL_URL is used by default, but can be overridden +# to match the Drupal production url, without the nginx prefix. +PUBLISHER_OAUTH2_TOKEN_HOST="${DRUPAL_EXTERNAL_URL}" diff --git a/apps/website/.lagoon.env.stage b/apps/website/.lagoon.env.stage new file mode 100644 index 000000000..89379ad89 --- /dev/null +++ b/apps/website/.lagoon.env.stage @@ -0,0 +1,28 @@ +PROJECT_NAME=example +DRUPAL_INTERNAL_URL="http://nginx:8080" +DRUPAL_EXTERNAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev" +NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" + +# ----------------------------------------------- +# Publisher authentication with Drupal (OAuth2). +# See main ./README.md for more information. +# ----------------------------------------------- +# Set to true to fully skip authentication. +PUBLISHER_SKIP_AUTHENTICATION=false + +# Secret from the Drupal Publisher Consumer. +PUBLISHER_OAUTH2_CLIENT_SECRET=REPLACE_ME + +# Client id from the Drupal Publisher Consumer. +PUBLISHER_OAUTH2_CLIENT_ID=publisher + +# A random string, used to encrypt the session. +PUBLISHER_OAUTH2_SESSION_SECRET=REPLACE_ME + +# "development" or "production", production will trust first proxy +# and serve secure cookies. +PUBLISHER_OAUTH2_ENVIRONMENT_TYPE=production + +# DRUPAL_EXTERNAL_URL is used by default, but can be overridden +# to match the Drupal production url, without the nginx prefix. +PUBLISHER_OAUTH2_TOKEN_HOST="${DRUPAL_EXTERNAL_URL}"