Skip to content

Commit

Permalink
refactor: improve lagoon environment variables
Browse files Browse the repository at this point in the history
Generic default variables that work with stock hostnames and specifics
for dev/stage/prod that allow custom domains.
  • Loading branch information
pmelab committed Apr 13, 2024
1 parent 3189edc commit 73f6b7f
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 6 deletions.
6 changes: 3 additions & 3 deletions apps/cms/.lagoon.env
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions apps/cms/.lagoon.env.prod
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions apps/cms/.lagoon.env.stage
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions apps/cms/lagoon.env.dev
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion apps/preview/.lagoon.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DRUPAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev"
DRUPAL_URL="https://nginx.${LAGOON_ENVIRONMENT}.${PROJECT_NAME}.ch4.amazee.io"
1 change: 1 addition & 0 deletions apps/preview/.lagoon.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DRUPAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev"
1 change: 1 addition & 0 deletions apps/preview/.lagoon.env.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DRUPAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev"
1 change: 1 addition & 0 deletions apps/preview/.lagoon.env.stage
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DRUPAL_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.cms.amazeelabs.dev"
4 changes: 2 additions & 2 deletions apps/website/.lagoon.env
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
28 changes: 28 additions & 0 deletions apps/website/.lagoon.env.dev
Original file line number Diff line number Diff line change
@@ -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}"
28 changes: 28 additions & 0 deletions apps/website/.lagoon.env.prod
Original file line number Diff line number Diff line change
@@ -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}"
28 changes: 28 additions & 0 deletions apps/website/.lagoon.env.stage
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit 73f6b7f

Please sign in to comment.