From c7259e5edba2c746b8907012658447d658f1b7db Mon Sep 17 00:00:00 2001 From: CobyPear Date: Mon, 14 Aug 2023 16:43:32 -0500 Subject: [PATCH 1/4] DB-6233: Add comments to .env.example env vars --- .changeset/happy-eggs-rescue.md | 6 +++++ .../src/templates/gatsby-wp/.env.example | 14 +++++++--- .../src/templates/next-drupal/.env.example | 23 +++++++++++----- .../src/templates/next-wp/.env.example | 26 ++++++++++++++----- 4 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 .changeset/happy-eggs-rescue.md diff --git a/.changeset/happy-eggs-rescue.md b/.changeset/happy-eggs-rescue.md new file mode 100644 index 000000000..1de924bac --- /dev/null +++ b/.changeset/happy-eggs-rescue.md @@ -0,0 +1,6 @@ +--- +'create-pantheon-decoupled-kit': patch +--- + +[next-wp][gatsby-wp][next-drupal] Add comments describing each env var in the +`.env.example` diff --git a/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example index a5bf185d8..0d5b51774 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example @@ -1,5 +1,11 @@ -# Optional environment variables are commented out +# The graphql endpoint of your WordPress instance WPGRAPHQL_URL=https://my-backend-site.pantheonsite.io/wp/graphql -#PANTHEON_UPLOAD_PATH=/example -#WP_APPLICATION_USERNAME= -#WP_APPLICATION_PASSWORD= + +# Credentials for a valid user in the WordPress instance +WP_APPLICATION_USERNAME=user +WP_APPLICATION_PASSWORD=example_pass + +# The value of Gatsby pathPrefix +# See https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/path-prefix/ for more information +# This value is only required if using the pathPrefix feature +PANTHEON_UPLOAD_PATH=/example diff --git a/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example index 009bbf1ae..c19c50034 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example @@ -1,14 +1,23 @@ -# Copy as .env.development.local to override envars for local development +# The URL of your Drupal site BACKEND_URL=http://my-backend-site.pantheonsite.io -FRONTEND_URL=http://my-frontend-site.pantheonsite.io -IMAGE_DOMAIN=my-frontend-site.pantheonsite.io -PREVIEW_SECRET=mysecret + +# The domain where your images are hosted. By default, we will set the domain of the BACKEND_URL +# to the value of IMAGE_DOMAIN. Set this if your images are hosted somewhere other than your WordPress instance +# See https://nextjs.org/docs/pages/api-reference/components/image#domains for more information +IMAGE_DOMAIN=some-other-domain.example + +# The secret set on your WordPress Preview Site. Required for preview functionality +PREVIEW_SECRET=super-secret-preview-secret + +# The credentials of your Drupal OAuth client CLIENT_ID=my-client-id CLIENT_SECRET=my-client-secret -NEXT_PUBLIC_FRONTEND_URL=$FRONTEND_URL # Sets debug mode for instance of DrupalState. -# Leave empty to turn off debug mode +# Leave empty or remove to turn off debug mode DEBUG_MODE= -#PANTHEON_UPLOAD_PATH=/example +# The value of Next.js basePath +# See https://nextjs.org/docs/pages/api-reference/next-config-js/basePath for more information +# This variable is only required if using the basePath feature +PANTHEON_UPLOAD_PATH=/example diff --git a/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example index b0789432f..da77b30d1 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example @@ -1,7 +1,19 @@ -# Optional environment variables are commented out -WPGRAPHQL_URL= -IMAGE_DOMAIN= -#PANTHEON_UPLOAD_PATH=/example -#PREVIEW_SECRET= -#WP_APPLICATION_USERNAME= -#WP_APPLICATION_PASSWORD= +# The graphql endpoint of your WordPress instance +WPGRAPHQL_URL=https://my-backend-site.pantheonsite.io/wp/graphql + +# The secret set on your WordPress Preview Site. Required for preview functionality +PREVIEW_SECRET=super-secret-preview-secret + +# The domain where your images are hosted. By default, we will set the domain of the WPGRAPHQL_URL +# to the value of IMAGE_DOMAIN. Set this if your images are hosted somewhere other than your WordPress instance +# See https://nextjs.org/docs/pages/api-reference/components/image#domains for more information +IMAGE_DOMAIN=some-other-domain.example + +# Credentials for a valid user in the WordPress instance +WP_APPLICATION_USERNAME=user +WP_APPLICATION_PASSWORD=example_pass + +# The value of Next.js basePath. +# See https://nextjs.org/docs/pages/api-reference/next-config-js/basePath for more information +# This variable is only required if using the basePath feature +PANTHEON_UPLOAD_PATH=/example From 909dddcaa1bac701e0a79a2c48760890e79aaacf Mon Sep 17 00:00:00 2001 From: CobyPear Date: Thu, 17 Aug 2023 15:48:16 -0500 Subject: [PATCH 2/4] DB-6233: CR revisions --- .../src/templates/gatsby-wp/.env.example | 4 +++- .../src/templates/next-drupal/.env.example | 6 ++++-- .../src/templates/next-wp/.env.example | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example index 0d5b51774..872606780 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example @@ -1,7 +1,9 @@ +# Copy as .env.development.local to override envars for local development + # The graphql endpoint of your WordPress instance WPGRAPHQL_URL=https://my-backend-site.pantheonsite.io/wp/graphql -# Credentials for a valid user in the WordPress instance +# Username and Application Password for a valid user in the WordPress instance WP_APPLICATION_USERNAME=user WP_APPLICATION_PASSWORD=example_pass diff --git a/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example index c19c50034..5775e787a 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example @@ -1,12 +1,14 @@ +# Copy as .env.development.local to override envars for local development + # The URL of your Drupal site BACKEND_URL=http://my-backend-site.pantheonsite.io # The domain where your images are hosted. By default, we will set the domain of the BACKEND_URL -# to the value of IMAGE_DOMAIN. Set this if your images are hosted somewhere other than your WordPress instance +# to the value of IMAGE_DOMAIN. Set this if your images are hosted somewhere other than your Drupal instance # See https://nextjs.org/docs/pages/api-reference/components/image#domains for more information IMAGE_DOMAIN=some-other-domain.example -# The secret set on your WordPress Preview Site. Required for preview functionality +# The secret set on your Drupal Preview Site. Required for preview functionality PREVIEW_SECRET=super-secret-preview-secret # The credentials of your Drupal OAuth client diff --git a/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example index da77b30d1..128ccf2a5 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example @@ -1,3 +1,5 @@ +# Copy as .env.development.local to override envars for local development + # The graphql endpoint of your WordPress instance WPGRAPHQL_URL=https://my-backend-site.pantheonsite.io/wp/graphql @@ -9,7 +11,7 @@ PREVIEW_SECRET=super-secret-preview-secret # See https://nextjs.org/docs/pages/api-reference/components/image#domains for more information IMAGE_DOMAIN=some-other-domain.example -# Credentials for a valid user in the WordPress instance +# Username and Application Password for a valid user in the WordPress instance WP_APPLICATION_USERNAME=user WP_APPLICATION_PASSWORD=example_pass From c3f35a8b2044254dd724bc4bec4f22ae660871d2 Mon Sep 17 00:00:00 2001 From: CobyPear Date: Fri, 18 Aug 2023 08:39:22 -0500 Subject: [PATCH 3/4] DB-6233: - CR revisions: copy edits - Fix link to preview site settings in dkhc --- .changeset/clever-chefs-exist.md | 5 +++++ .../src/templates/gatsby-wp/.env.example | 12 ++++++----- .../src/templates/next-drupal/.env.example | 14 +++++++------ .../src/templates/next-wp/.env.example | 20 +++++++++++-------- .../NextWordPressHealthCheck.test.ts.snap | 2 +- .../src/classes/NextWordPressHealthCheck.ts | 2 +- 6 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 .changeset/clever-chefs-exist.md diff --git a/.changeset/clever-chefs-exist.md b/.changeset/clever-chefs-exist.md new file mode 100644 index 000000000..4ded4efd6 --- /dev/null +++ b/.changeset/clever-chefs-exist.md @@ -0,0 +1,5 @@ +--- +'@pantheon-systems/decoupled-kit-health-check': patch +--- + +Fix link to WordPress preview site settings diff --git a/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example index 872606780..48fdb22c7 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/gatsby-wp/.env.example @@ -1,13 +1,15 @@ # Copy as .env.development.local to override envars for local development +# Optional environment variables are commented out # The graphql endpoint of your WordPress instance WPGRAPHQL_URL=https://my-backend-site.pantheonsite.io/wp/graphql # Username and Application Password for a valid user in the WordPress instance -WP_APPLICATION_USERNAME=user -WP_APPLICATION_PASSWORD=example_pass +# Required to fetch private content from WordPress +# WP_APPLICATION_USERNAME=user +# WP_APPLICATION_PASSWORD=example_pass -# The value of Gatsby pathPrefix -# See https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/path-prefix/ for more information +# Sets the gatsby.config.pathPrefix setting for you # This value is only required if using the pathPrefix feature -PANTHEON_UPLOAD_PATH=/example +# See https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/path-prefix/ for more information +# PANTHEON_UPLOAD_PATH=/example diff --git a/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example index 5775e787a..f98486124 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example @@ -1,4 +1,5 @@ # Copy as .env.development.local to override envars for local development +# Optional environment variables are commented out # The URL of your Drupal site BACKEND_URL=http://my-backend-site.pantheonsite.io @@ -6,20 +7,21 @@ BACKEND_URL=http://my-backend-site.pantheonsite.io # The domain where your images are hosted. By default, we will set the domain of the BACKEND_URL # to the value of IMAGE_DOMAIN. Set this if your images are hosted somewhere other than your Drupal instance # See https://nextjs.org/docs/pages/api-reference/components/image#domains for more information -IMAGE_DOMAIN=some-other-domain.example +# IMAGE_DOMAIN=some-other-domain.example # The secret set on your Drupal Preview Site. Required for preview functionality -PREVIEW_SECRET=super-secret-preview-secret +# To set a new secret, go to https://{your Drupal domain}/admin/structure/dp-preview-site +# PREVIEW_SECRET=super-secret-preview-secret # The credentials of your Drupal OAuth client -CLIENT_ID=my-client-id -CLIENT_SECRET=my-client-secret +# CLIENT_ID=my-client-id +# CLIENT_SECRET=my-client-secret # Sets debug mode for instance of DrupalState. # Leave empty or remove to turn off debug mode -DEBUG_MODE= +# DEBUG_MODE=true # The value of Next.js basePath # See https://nextjs.org/docs/pages/api-reference/next-config-js/basePath for more information # This variable is only required if using the basePath feature -PANTHEON_UPLOAD_PATH=/example +# PANTHEON_UPLOAD_PATH=/example diff --git a/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example index 128ccf2a5..b573bb2b2 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example @@ -1,21 +1,25 @@ # Copy as .env.development.local to override envars for local development +# Optional environment variables are commented out # The graphql endpoint of your WordPress instance WPGRAPHQL_URL=https://my-backend-site.pantheonsite.io/wp/graphql +# Username and Application Password for a valid user in the WordPress instance +# Required to fetch private content from WordPress +# WP_APPLICATION_USERNAME=user +# WP_APPLICATION_PASSWORD=example_pass + # The secret set on your WordPress Preview Site. Required for preview functionality -PREVIEW_SECRET=super-secret-preview-secret +# To set a new secret, go to https://{your WordPress domain}/wp/wp-admin/options-general.php?page=preview_sites +# PREVIEW_SECRET=super-secret-preview-secret # The domain where your images are hosted. By default, we will set the domain of the WPGRAPHQL_URL # to the value of IMAGE_DOMAIN. Set this if your images are hosted somewhere other than your WordPress instance # See https://nextjs.org/docs/pages/api-reference/components/image#domains for more information -IMAGE_DOMAIN=some-other-domain.example +# IMAGE_DOMAIN=some-other-domain.example -# Username and Application Password for a valid user in the WordPress instance -WP_APPLICATION_USERNAME=user -WP_APPLICATION_PASSWORD=example_pass -# The value of Next.js basePath. -# See https://nextjs.org/docs/pages/api-reference/next-config-js/basePath for more information +# Sets the next.config.basePath setting for you # This variable is only required if using the basePath feature -PANTHEON_UPLOAD_PATH=/example +# See https://nextjs.org/docs/pages/api-reference/next-config-js/basePath for more information +# PANTHEON_UPLOAD_PATH=/example diff --git a/packages/decoupled-kit-health-check/__tests__/__snapshots__/NextWordPressHealthCheck.test.ts.snap b/packages/decoupled-kit-health-check/__tests__/__snapshots__/NextWordPressHealthCheck.test.ts.snap index af4da45e7..8403bc298 100644 --- a/packages/decoupled-kit-health-check/__tests__/__snapshots__/NextWordPressHealthCheck.test.ts.snap +++ b/packages/decoupled-kit-health-check/__tests__/__snapshots__/NextWordPressHealthCheck.test.ts.snap @@ -70,7 +70,7 @@ exports[`NextWordPressHealthCheck > should pass for a valid backend and valid au "|__✅ Auth is valid!", "Checking for PREVIEW_SECRET...", "|__💡 PREVIEW_SECRET env var is not set.", - "|____ To set a new secret, go to 🔗 https://wordpress.test/admin/structure/dp-preview-site and edit the preview site you want to use.", + "|____ To set a new secret, go to 🔗 https://wordpress.test/wp/wp-admin/options-general.php?page=preview_sites and edit the preview site you want to use.", "⏭ Skipping preview endpoint validation -- PREVIEW_SECRET required.", ] `; diff --git a/packages/decoupled-kit-health-check/src/classes/NextWordPressHealthCheck.ts b/packages/decoupled-kit-health-check/src/classes/NextWordPressHealthCheck.ts index 4a98079c8..015401637 100644 --- a/packages/decoupled-kit-health-check/src/classes/NextWordPressHealthCheck.ts +++ b/packages/decoupled-kit-health-check/src/classes/NextWordPressHealthCheck.ts @@ -215,7 +215,7 @@ export class NextWordPressHealthCheck extends WordPressHealthCheck { this.log.suggest( `To set a new secret, go to 🔗 https://${ this.getURL().host - }/admin/structure/dp-preview-site and edit the preview site you want to use.`, + }/wp/wp-admin/options-general.php?page=preview_sites and edit the preview site you want to use.`, ); console.log( '⏭ Skipping preview endpoint validation -- PREVIEW_SECRET required.', From 89d54d44c56ddf59f3445aa687baef37b0a11a00 Mon Sep 17 00:00:00 2001 From: CobyPear Date: Tue, 22 Aug 2023 08:37:11 -0500 Subject: [PATCH 4/4] DB-6233: Add link to preview docs --- .../src/templates/next-drupal/.env.example | 2 +- .../src/templates/next-wp/.env.example | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example index f98486124..fc38baedf 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/next-drupal/.env.example @@ -10,7 +10,7 @@ BACKEND_URL=http://my-backend-site.pantheonsite.io # IMAGE_DOMAIN=some-other-domain.example # The secret set on your Drupal Preview Site. Required for preview functionality -# To set a new secret, go to https://{your Drupal domain}/admin/structure/dp-preview-site +# See https://decoupledkit.pantheon.io/docs/backend-starters/decoupled-drupal/configuring-preview-site for more information on configuring a preview site # PREVIEW_SECRET=super-secret-preview-secret # The credentials of your Drupal OAuth client diff --git a/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example b/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example index b573bb2b2..2fe8a7563 100644 --- a/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example +++ b/packages/create-pantheon-decoupled-kit/src/templates/next-wp/.env.example @@ -10,7 +10,7 @@ WPGRAPHQL_URL=https://my-backend-site.pantheonsite.io/wp/graphql # WP_APPLICATION_PASSWORD=example_pass # The secret set on your WordPress Preview Site. Required for preview functionality -# To set a new secret, go to https://{your WordPress domain}/wp/wp-admin/options-general.php?page=preview_sites +# See https://decoupledkit.pantheon.io/docs/backend-starters/decoupled-wordpress/configuring-preview-site for more information on configuring a preview site # PREVIEW_SECRET=super-secret-preview-secret # The domain where your images are hosted. By default, we will set the domain of the WPGRAPHQL_URL