Skip to content

Commit

Permalink
VITE_APP_FULL_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
devincowan committed Jan 6, 2024
1 parent 094d4a9 commit 65f5896
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/frontend-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: |
touch .env
echo VITE_APP_API_URL=${{ secrets.VITE_APP_API_URL }} >> .env
echo VITE_APP_URL=${{ secrets.VITE_APP_URL }} >> .env
echo VITE_APP_FULL_URL=${{ secrets.VITE_APP_FULL_URL }} >> .env
echo VITE_OAUTH2_REDIRECT_URL=${{ secrets.VITE_OAUTH2_REDIRECT_URL }} >> .env
echo VITE_APP_BASE=${{ secrets.VITE_APP_BASE }} >> .env
cp .env ../.env
Expand Down
21 changes: 15 additions & 6 deletions app/env.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,23 @@ VITE_APP_NAME=subsetter
VITE_APP_ORIGIN=https://localhost

# for nested static deployment, set VITE_APP_BASE=/domain-subsetter/
# VITE_APP_BASE=/domain-subsetter/
VITE_APP_BASE=/

# VITE_APP_FULL_URL=${VITE_APP_ORIGIN}${VITE_APP_BASE}
VITE_APP_FULL_URL=https://localhost/

VITE_APP_URL=${VITE_APP_ORIGIN}${VITE_APP_BASE}
VITE_APP_API_HOST=localhost
VITE_APP_API_URL=https://${VITE_APP_API_HOST}/api

ALLOW_ORIGINS=${VITE_APP_ORIGIN}
OAUTH2_REDIRECT_URL=${VITE_APP_API_URL}/auth/cuahsi/callback
# VITE_APP_API_URL=https://${VITE_APP_API_HOST}/api
VITE_APP_API_URL=https://localhost/api

# ALLOW_ORIGINS=${VITE_APP_ORIGIN}
ALLOW_ORIGINS=https://localhost

# OAUTH2_REDIRECT_URL=${VITE_APP_API_URL}/auth/cuahsi/callback
OAUTH2_REDIRECT_URL=https://localhost/api/auth/cuahsi/callback

# VITE_OAUTH2_REDIRECT_URL="${VITE_APP_FULL_URL}#/auth-redirect"
VITE_OAUTH2_REDIRECT_URL="http://localhost/#/auth-redirect"

VITE_OAUTH2_REDIRECT_URL="${VITE_APP_URL}#/auth-redirect"
OIDC_BASE_URL=https://auth.cuahsi.io/realms/CUAHSI/protocol/openid-connect/
2 changes: 1 addition & 1 deletion app/frontend/src/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export async function logIn(callback) {
const authUrl = new URL(json.authorization_url)
// TODO: use an env var for auth redirect instead of hard-coding
// "#" hash routing was not passed from github env secret so had to hard code here.
authUrl.searchParams.set('redirect_uri', `${APP_URL}/#/auth-redirect`)
authUrl.searchParams.set('redirect_uri', `${APP_URL}#/auth-redirect`)
window.open(
authUrl.toString(),
'_blank',
Expand Down
2 changes: 1 addition & 1 deletion app/frontend/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const APP_NAME = import.meta.env.VITE_APP_NAME || "";
export const APP_URL = import.meta.env.VITE_APP_URL || "";
export const APP_URL = import.meta.env.VITE_APP_FULL_URL || "";
export const APP_BASE = import.meta.env.VITE_APP_BASE || "";

export const API_BASE = import.meta.env.VITE_APP_API_URL || "";
Expand Down

0 comments on commit 65f5896

Please sign in to comment.