Skip to content

Commit

Permalink
Clean up README and env vars (#994)
Browse files Browse the repository at this point in the history
  • Loading branch information
will0684 authored Apr 4, 2024
1 parent 8e46236 commit a1b287f
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 25 deletions.
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,43 @@ 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

## Environment Variables

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)

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/notify/postFeedbackToGcNotify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pages/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
2 changes: 1 addition & 1 deletion pages/projects/benefits-navigator/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
2 changes: 1 addition & 1 deletion pages/projects/benefits-navigator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
2 changes: 1 addition & 1 deletion pages/projects/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
2 changes: 1 addition & 1 deletion pages/projects/digital-standards-playbook/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
2 changes: 1 addition & 1 deletion pages/projects/digital-standards-playbook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
2 changes: 1 addition & 1 deletion pages/projects/making-easier-get-benefits/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
2 changes: 1 addition & 1 deletion pages/projects/making-easier-get-benefits/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
2 changes: 1 addition & 1 deletion pages/projects/oas-benefits-estimator/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};
2 changes: 1 addition & 1 deletion pages/projects/oas-benefits-estimator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
};

0 comments on commit a1b287f

Please sign in to comment.