From a1b287fd9c0f47a3318d0ed70792eec298aeab50 Mon Sep 17 00:00:00 2001 From: Jordan Willis <31868510+will0684@users.noreply.github.com> Date: Thu, 4 Apr 2024 10:39:45 -0400 Subject: [PATCH] Clean up README and env vars (#994) --- README.md | 26 +++++++++---------- lib/notify/postFeedbackToGcNotify.js | 2 +- pages/home.js | 2 +- pages/projects/benefits-navigator/[id].js | 2 +- pages/projects/benefits-navigator/index.js | 2 +- pages/projects/dashboard/index.js | 2 +- .../digital-standards-playbook/[id].js | 2 +- .../digital-standards-playbook/index.js | 2 +- .../making-easier-get-benefits/[id].js | 2 +- .../making-easier-get-benefits/index.js | 2 +- pages/projects/oas-benefits-estimator/[id].js | 2 +- .../projects/oas-benefits-estimator/index.js | 2 +- 12 files changed, 23 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 10ab6d194c..f7a026da94 100644 --- a/README.md +++ b/README.md @@ -19,34 +19,33 @@ yarn dev Create and run a production build locally\*\*\*: -\*\*\* Will require `AEM_GRAPHQL_ENDPOINT=https://www.canada.ca/content/_cq_graphql/decd-endc/endpoint.json` and `ADOBE_ANALYTICS_URL=` the second being avariable with no value. These env vars should be in a top-level .env file +\*\*\* Will require `AEM_GRAPHQL_ENDPOINT=https://www.canada.ca/content/_cq_graphql/decd-endc/endpoint.json` ```bash yarn build yarn start ``` -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +Open [http://localhost:3000](http://localhost:3000) with your browser. ## Configuration -There are two required variables: `AEM_GRAPHQL_ENDPOINT=https://www.canada.ca/content/_cq_graphql/decd-endc/endpoint.json` and `ADOBE_ANALYTICS_URL=` +There is one required variable: `AEM_GRAPHQL_ENDPOINT=https://www.canada.ca/content/_cq_graphql/decd-endc/endpoint.json` -`AEM_GRAPHQL_ENDPOINT` is used to fetch the data for pages and components across the site. +`AEM_GRAPHQL_ENDPOINT` is used to fetch the content, and for some pages (articles), the structure of the pages on the site. -## Enabling Report a Problem +## Enabling Submit Feedback Required environment variables: ```code -REPORT_A_PROBLEM_ENABLED=true NOTIFY_BASE_API_URL=https://api.notification.canada.ca -NOTIFY_REPORT_A_PROBLEM_EMAIL=email which will receive the feedback from the form NOTIFY_API_KEY=ask for this -NOTIFY_REPORT_A_PROBLEM_TEMPLATE_ID=ask for this +NOTIFY_FEEDBACK_TEMPLATE_ID=ask for this +SUBMIT_FEEDBACK_EMAIL=ask for this ``` -1. Ask the dev team for GCNotify API key and template keys +1. Ask the dev team for GCNotify API key, template keys and feedback email 2. Start the application as usual @@ -54,12 +53,9 @@ NOTIFY_REPORT_A_PROBLEM_TEMPLATE_ID=ask for this Here is a list of all the environment variables used to configure the application along with what they do. -`REPORT_A_PROBLEM_ENABLED`: Feature flag for the report a problem API to enable sending to GC Notify. Leave undefined if -you do not want to enable this. +`NOTIFY_FEEDBACK_TEMPLATE_ID`: The Notify template ID for the submit feedback template -`NEXT_PUBLIC_NOTIFY_REPORT_A_PROBLEM_TEMPLATE_ID`: The Notify template ID for the report a problem email template - -`NEXT_PUBLIC_NOTIFY_REPORT_A_PROBLEM_EMAIL`: The email to send it to +`SUBMIT_FEEDBACK_EMAIL`: The email to which feedback will be sent `NOTIFY_API_KEY`: The [Notify API key](https://documentation.notification.canada.ca/en/start.html#headers) @@ -68,6 +64,8 @@ you do not want to enable this. `ADOBE_ANALYTICS_URL`: URL for adobe analytics. It is found in the documentation for Adobe Analytics installation. +`ISR_ENABLED`: Whether Incremental Static Regeneration should be enabled on pages that leverage it. + ## Checking Deployed Version Run the following bash script to check whether the latest (on `main`) has been deployed to various environments: ```bash diff --git a/lib/notify/postFeedbackToGcNotify.js b/lib/notify/postFeedbackToGcNotify.js index b83be06f3f..b65b3e0856 100644 --- a/lib/notify/postFeedbackToGcNotify.js +++ b/lib/notify/postFeedbackToGcNotify.js @@ -8,7 +8,7 @@ export async function postFeedbackToGcNotify(data) { Authorization: `ApiKey-v1 ${process.env.NOTIFY_API_KEY}`, }, body: JSON.stringify({ - email_address: process.env.THANK_YOU_EMAIL, + email_address: process.env.SUBMIT_FEEDBACK_EMAIL, template_id: process.env.NOTIFY_FEEDBACK_TEMPLATE_ID, personalisation: { ...data, diff --git a/pages/home.js b/pages/home.js index d793718e63..8c53432e1a 100644 --- a/pages/home.js +++ b/pages/home.js @@ -422,6 +422,6 @@ export const getStaticProps = async ({ locale }) => { experimentsData: experimentsData.sclabsPageV1List.items, ...(await serverSideTranslations(locale, ["common"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; }; diff --git a/pages/projects/benefits-navigator/[id].js b/pages/projects/benefits-navigator/[id].js index c34c03bf0b..0dd14f4522 100644 --- a/pages/projects/benefits-navigator/[id].js +++ b/pages/projects/benefits-navigator/[id].js @@ -130,6 +130,6 @@ export const getStaticProps = async ({ locale, params }) => { adobeAnalyticsUrl: process.env.ADOBE_ANALYTICS_URL ?? null, ...(await serverSideTranslations(locale, ["common", "vc"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; }; diff --git a/pages/projects/benefits-navigator/index.js b/pages/projects/benefits-navigator/index.js index 8895c5d589..4f724040bb 100644 --- a/pages/projects/benefits-navigator/index.js +++ b/pages/projects/benefits-navigator/index.js @@ -738,6 +738,6 @@ export const getStaticProps = async ({ locale }) => { dictionary: dictionary.dictionaryV1List, ...(await serverSideTranslations(locale, ["common"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; }; diff --git a/pages/projects/dashboard/index.js b/pages/projects/dashboard/index.js index 0b01d600dc..0e9bb5ae69 100644 --- a/pages/projects/dashboard/index.js +++ b/pages/projects/dashboard/index.js @@ -810,6 +810,6 @@ export const getStaticProps = async ({ locale }) => { dictionary: dictionary.dictionaryV1List, ...(await serverSideTranslations(locale, ["common"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; }; diff --git a/pages/projects/digital-standards-playbook/[id].js b/pages/projects/digital-standards-playbook/[id].js index 35126dff68..a126cd81f5 100644 --- a/pages/projects/digital-standards-playbook/[id].js +++ b/pages/projects/digital-standards-playbook/[id].js @@ -133,6 +133,6 @@ export const getStaticProps = async ({ locale, params }) => { adobeAnalyticsUrl: process.env.ADOBE_ANALYTICS_URL ?? null, ...(await serverSideTranslations(locale, ["common"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; }; diff --git a/pages/projects/digital-standards-playbook/index.js b/pages/projects/digital-standards-playbook/index.js index aed7bd625d..520e12fbec 100644 --- a/pages/projects/digital-standards-playbook/index.js +++ b/pages/projects/digital-standards-playbook/index.js @@ -478,6 +478,6 @@ export const getStaticProps = async ({ locale }) => { dictionary: dictionary.dictionaryV1List, ...(await serverSideTranslations(locale, ["common"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; }; diff --git a/pages/projects/making-easier-get-benefits/[id].js b/pages/projects/making-easier-get-benefits/[id].js index 829d00f7d2..7270672585 100644 --- a/pages/projects/making-easier-get-benefits/[id].js +++ b/pages/projects/making-easier-get-benefits/[id].js @@ -133,6 +133,6 @@ export const getStaticProps = async ({ locale, params }) => { adobeAnalyticsUrl: process.env.ADOBE_ANALYTICS_URL ?? null, ...(await serverSideTranslations(locale, ["common"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; }; diff --git a/pages/projects/making-easier-get-benefits/index.js b/pages/projects/making-easier-get-benefits/index.js index bacb0608d4..c214f387a5 100644 --- a/pages/projects/making-easier-get-benefits/index.js +++ b/pages/projects/making-easier-get-benefits/index.js @@ -373,6 +373,6 @@ export const getStaticProps = async ({ locale }) => { dictionary: dictionary.dictionaryV1List, ...(await serverSideTranslations(locale, ["common"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; }; diff --git a/pages/projects/oas-benefits-estimator/[id].js b/pages/projects/oas-benefits-estimator/[id].js index f5b2cae3c8..6ab6cf1564 100644 --- a/pages/projects/oas-benefits-estimator/[id].js +++ b/pages/projects/oas-benefits-estimator/[id].js @@ -133,6 +133,6 @@ export const getStaticProps = async ({ locale, params }) => { adobeAnalyticsUrl: process.env.ADOBE_ANALYTICS_URL ?? null, ...(await serverSideTranslations(locale, ["common"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; }; diff --git a/pages/projects/oas-benefits-estimator/index.js b/pages/projects/oas-benefits-estimator/index.js index 735fe84124..46e23b8053 100644 --- a/pages/projects/oas-benefits-estimator/index.js +++ b/pages/projects/oas-benefits-estimator/index.js @@ -430,6 +430,6 @@ export const getStaticProps = async ({ locale }) => { dictionary: dictionary.dictionaryV1List, ...(await serverSideTranslations(locale, ["common"])), }, - revalidate: process.env.ENVIRONMENT === "development" ? 10 : false, + revalidate: process.env.ISR_ENABLED === "true" ? 10 : false, }; };