From c681f05a63e30b2398631665fefda582e713ded1 Mon Sep 17 00:00:00 2001 From: Allie Micka Date: Fri, 7 Feb 2025 10:39:56 -0600 Subject: [PATCH 1/5] [PGOV-563] Consolidate .env files for consistency and document-ability --- .ddev/.env.pgov-example | 9 +++++++++ src/frontend/.env.example | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 src/frontend/.env.example diff --git a/.ddev/.env.pgov-example b/.ddev/.env.pgov-example index ba16a29c..52362576 100644 --- a/.ddev/.env.pgov-example +++ b/.ddev/.env.pgov-example @@ -6,3 +6,12 @@ # data.records:read # schema.bases:read AIRTABLE_API_KEY="" + +# See https://next-drupal.org/docs/environment-variables +NEXT_PUBLIC_DRUPAL_BASE_URL=http://performance.ddev.site +NEXT_IMAGE_DOMAIN=performance.ddev.site + +# Authentication +DRUPAL_CLIENT_ID= +DRUPAL_CLIENT_SECRET= + diff --git a/src/frontend/.env.example b/src/frontend/.env.example deleted file mode 100644 index 97aa6dae..00000000 --- a/src/frontend/.env.example +++ /dev/null @@ -1,8 +0,0 @@ -# See https://next-drupal.org/docs/environment-variables -NEXT_PUBLIC_DRUPAL_BASE_URL=http://performance.ddev.site -NEXT_IMAGE_DOMAIN=performance.ddev.site - -# Authentication -DRUPAL_CLIENT_ID= -DRUPAL_CLIENT_SECRET= - From de78cbe68af74db1d2aac790dc11b8e8ffadaa2f Mon Sep 17 00:00:00 2001 From: Allie Micka Date: Fri, 7 Feb 2025 10:41:03 -0600 Subject: [PATCH 2/5] [PGOV-563] Add front-end service to ddev. --- .ddev/config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.ddev/config.yaml b/.ddev/config.yaml index ef32fa0b..01818436 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -15,11 +15,18 @@ web_environment: - DRUSH_ALLOW_XDEBUG=1 corepack_enable: false web_extra_exposed_ports: + - name: "Next.js Front End" + container_port: 3000 + https_port: 3000 + http_port: 3001 - name: "Documentation" container_port: 4000 https_port: 4000 http_port: 4001 web_extra_daemons: + - name: "frontend" + command: "npm install && npm run dev -H 0.0.0.0 -p 3000" + directory: /var/www/html/src/frontend - name: "docs" command: "npm install && npm run start -- -h 0.0.0.0 -p 4000" directory: /var/www/html/docs From 3dc34798a8e3e894d68f4b0a8d4682cce8a3791d Mon Sep 17 00:00:00 2001 From: Allie Micka Date: Fri, 7 Feb 2025 13:14:38 -0600 Subject: [PATCH 3/5] [PGOV-563] Guarantee the presence of a .ddev/.env file --- .ddev/.env.pgov-example | 4 ++-- .ddev/config.yaml | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.ddev/.env.pgov-example b/.ddev/.env.pgov-example index 52362576..5465f34e 100644 --- a/.ddev/.env.pgov-example +++ b/.ddev/.env.pgov-example @@ -8,10 +8,10 @@ AIRTABLE_API_KEY="" # See https://next-drupal.org/docs/environment-variables -NEXT_PUBLIC_DRUPAL_BASE_URL=http://performance.ddev.site +NEXT_PUBLIC_DRUPAL_BASE_URL=https://performance.ddev.site NEXT_IMAGE_DOMAIN=performance.ddev.site -# Authentication +# Authentication for the NextJS App DRUPAL_CLIENT_ID= DRUPAL_CLIENT_SECRET= diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 01818436..14e753db 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -25,11 +25,15 @@ web_extra_exposed_ports: http_port: 4001 web_extra_daemons: - name: "frontend" - command: "npm install && npm run dev -H 0.0.0.0 -p 3000" + command: "npm install && npm run dev -- -H 0.0.0.0 -p 3000" directory: /var/www/html/src/frontend - name: "docs" command: "npm install && npm run start -- -h 0.0.0.0 -p 4000" directory: /var/www/html/docs +hooks: + # Ensure the .env file is present. + pre-start: + - exec-host: "ls .ddev/.env || (cd .ddev && cp .env.pgov-example .env)" # Key features of DDEV's config.yaml: From 2178da82c506997a008f2a1f4b90790612cf6211 Mon Sep 17 00:00:00 2001 From: Allie Micka Date: Fri, 7 Feb 2025 13:57:22 -0600 Subject: [PATCH 4/5] [PGOV-563] Suppress error output when initializing .env files --- .ddev/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 14e753db..139b17ce 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -33,7 +33,7 @@ web_extra_daemons: hooks: # Ensure the .env file is present. pre-start: - - exec-host: "ls .ddev/.env || (cd .ddev && cp .env.pgov-example .env)" + - exec-host: "(ls .ddev/.envs > /dev/null 2>error) || (cd .ddev && cp .env.pgov-example .env)" # Key features of DDEV's config.yaml: From f7045a2c411c4a30004300fcb659b9cffdb02fe8 Mon Sep 17 00:00:00 2001 From: Allie Micka Date: Fri, 7 Feb 2025 15:05:53 -0600 Subject: [PATCH 5/5] [PGOV-563] Ensure the presence of basic auth credentials --- .ddev/.env.pgov-example | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.ddev/.env.pgov-example b/.ddev/.env.pgov-example index 5465f34e..cb2c4322 100644 --- a/.ddev/.env.pgov-example +++ b/.ddev/.env.pgov-example @@ -1,11 +1,8 @@ # Copy this file to `.env` and update the default values for PGOV development. -# Obtain a personal access token at https://airtable.com/create/tokens while -# logged in as a sufficiently-permissioned user. -# Scopes should include: -# data.records:read -# schema.bases:read -AIRTABLE_API_KEY="" +# +BASIC_AUTH_USER="admin" +BASIC_AUTH_PASSWORD="civicactions" # See https://next-drupal.org/docs/environment-variables NEXT_PUBLIC_DRUPAL_BASE_URL=https://performance.ddev.site @@ -15,3 +12,9 @@ NEXT_IMAGE_DOMAIN=performance.ddev.site DRUPAL_CLIENT_ID= DRUPAL_CLIENT_SECRET= +# Obtain a personal access token at https://airtable.com/create/tokens while +# logged in as a sufficiently-permissioned user. +# Scopes should include: +# data.records:read +# schema.bases:read +AIRTABLE_API_KEY=""