Skip to content

Commit

Permalink
chore: rename env name for thegraph api key
Browse files Browse the repository at this point in the history
Remove the NEXT_PUBLIC_ prefix because it's now a runtime variable
  • Loading branch information
jycssu-com committed Jun 12, 2024
1 parent 6d1926c commit 26e1c5f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BUILD_ENV=
COMMUNITY_API_KEY=
NEXT_PUBLIC_THEGRAPH_API_KEY=
THEGRAPH_API_KEY=
2 changes: 1 addition & 1 deletion .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ jobs:
docker login -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWD }} ${DOCKER_REGISTRY}
docker compose --project-name ${{ github.ref_name }}-dashboard --file docker-compose-branch.yml up -d'
env:
NEXT_PUBLIC_THEGRAPH_API_KEY: ${{ secrets.NEXT_PUBLIC_THEGRAPH_API_KEY }}
THEGRAPH_API_KEY: ${{ secrets.THEGRAPH_API_KEY }}
COMMUNITY_API_KEY: ${{ secrets.COMMUNITY_API_KEY }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ To run the project you will need to set-up a `.env` file in the root folder:

```
COMMUNITY_API_KEY=XXXXXXXXXXXX
NEXT_PUBLIC_THEGRAPH_API_KEY=XXXXXXXXXXXX
THEGRAPH_API_KEY=XXXXXXXXXXXX
```

To get a `COMMUNITY_API_KEY`, join the dedicated [telegram dev channel](https://t.me/+XQyoaFfmN61yk7X0) then ask for.

To get a NEXT_PUBLIC_THEGRAPH_API_KEY, you need to create an account on thegraph.com [Thegraph docs](https://thegraph.com/docs/en/querying/managing-api-keys/)
To get a THEGRAPH_API_KEY, you need to create an account on thegraph.com [Thegraph docs](https://thegraph.com/docs/en/querying/managing-api-keys/)

### Node.js version

Expand Down
2 changes: 1 addition & 1 deletion docker-compose-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
image: ${DOCKER_REGISTRY}/dashboard:${DOCKER_BRANCH}
container_name: ${DOCKER_BRANCH}-dashboard
environment:
- NEXT_PUBLIC_THEGRAPH_API_KEY=$NEXT_PUBLIC_THEGRAPH_API_KEY
- THEGRAPH_API_KEY=$THEGRAPH_API_KEY
- COMMUNITY_API_KEY=$COMMUNITY_API_KEY
networks:
- traefik-realt
Expand Down
7 changes: 2 additions & 5 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ const libraryConnectors = getConnectors({

export const getServerSideProps = async () => ({
props: {
THEGRAPH_API_KEY:
process.env.THEGRAPH_API_KEY ?? process.env.NEXT_PUBLIC_THEGRAPH_API_KEY,
THEGRAPH_API_KEY: process.env.THEGRAPH_API_KEY,
},
})

Expand Down Expand Up @@ -120,9 +119,7 @@ const App = ({ Component, pageProps, colorScheme, env }: AppProps) => {
App.getInitialProps = ({ ctx }: { ctx: GetServerSidePropsContext }) => {
return {
env: {
THEGRAPH_API_KEY:
process.env.THEGRAPH_API_KEY ??
process.env.NEXT_PUBLIC_THEGRAPH_API_KEY,
THEGRAPH_API_KEY: process.env.THEGRAPH_API_KEY,
},
colorScheme: getCookie('mantine-color-scheme', ctx) || 'dark',
locale: getCookie('react-i18next', ctx) || 'fr',
Expand Down

0 comments on commit 26e1c5f

Please sign in to comment.