Skip to content

Commit

Permalink
Merge branch 'conditional' into develop_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
devincowan committed Jan 6, 2024
2 parents eedfc95 + 65f5896 commit d63d90e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/frontend-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ 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
- name: Install dependencies
run: npm install
Expand Down
30 changes: 22 additions & 8 deletions app/env.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,28 @@ MINIO_SECRET_KEY=
MINIO_API_URL=api.minio.cuahsi.io

VITE_APP_NAME=subsetter
VITE_APP_ORIGIN=http://localhost:5173
VITE_APP_BASE=/domain-subsetter/
VITE_APP_URL=${VITE_APP_ORIGIN}${VITE_APP_BASE}

# if using npm run dev, set VITE_APP_ORIGIN=http://localhost:5173
VITE_APP_ORIGIN=https://localhost

# for nested static deployment, set 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_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=${VITE_APP_API_URL}
OIDC_BASE_URL=https://auth.cuahsi.io/realms/CUAHSI/protocol/openid-connect/
2 changes: 1 addition & 1 deletion app/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:20.9.0 as build-stage
WORKDIR /app
COPY env.template ../.env
COPY .env ../.env
COPY ./frontend .
RUN npm update
RUN npm run build
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
10 changes: 7 additions & 3 deletions app/frontend/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import { fileURLToPath, URL } from 'url'

import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vuetify from 'vite-plugin-vuetify'

// https://vitejs.dev/config/
export default defineConfig({
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd())
return {
plugins: [
vue(),
vuetify(),
],
root: "./",
base: "/domain-subsetter/",
// for GH pages deployment, set VITE_APP_BASE=/domain-subsetter/ in .env
base: env.VITE_APP_BASE || "/",
envDir: "../",
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
}
})

0 comments on commit d63d90e

Please sign in to comment.