Skip to content

Commit

Permalink
fix: NEXT_PUBLIC_OIDC_SERVER_URL must be set on build to be accessed …
Browse files Browse the repository at this point in the history
…on client side
  • Loading branch information
vincentchalamon committed Jul 12, 2024
1 parent f669e19 commit 16d6c00
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ jobs:
-
name: Generate AUTH_SECRET
run: echo "AUTH_SECRET=$(openssl rand -hex 32)" >> $GITHUB_ENV
# https://nextjs.org/docs/app/building-your-application/configuring/environment-variables#bundling-environment-variables-for-the-browser
-
name: Generate NEXT_PUBLIC_OIDC_SERVER_URL
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "NEXT_PUBLIC_OIDC_SERVER_URL=https://demo.api-platform.com/oidc/realms/demo" >> $GITHUB_ENV
else
echo "NEXT_PUBLIC_OIDC_SERVER_URL=https://pr-${{ github.event.pull_request.number }}-demo.api-platform.com/oidc/realms/demo" >> $GITHUB_ENV
fi
-
name: Build Docker images
uses: docker/bake-action@v5
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ jobs:
POSTGRES_PASSWORD: aae5bf316ef5fe87ad806c6a9240fff68bcfdaf7
KEYCLOAK_POSTGRES_PASSWORD: 26d7f630f1524eb210bbf496443f2038a9316e9e
KEYCLOAK_ADMIN_PASSWORD: 2f31e2fad93941b818449fd8d57fd019b6ce7fa5
# https://nextjs.org/docs/app/building-your-application/configuring/environment-variables#bundling-environment-variables-for-the-browser
NEXT_PUBLIC_OIDC_SERVER_URL: https://localhost/oidc/realms/demo
# https://docs.docker.com/compose/environment-variables/envvars/#compose_file
COMPOSE_FILE: compose.yaml:compose.prod.yaml:compose.e2e.yaml
steps:
Expand Down
1 change: 1 addition & 0 deletions compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
target: prod
args:
AUTH_SECRET: ${AUTH_SECRET}
NEXT_PUBLIC_OIDC_SERVER_URL: ${NEXT_PUBLIC_OIDC_SERVER_URL}
environment:
AUTH_SECRET: ${AUTH_SECRET}

Expand Down

0 comments on commit 16d6c00

Please sign in to comment.