Skip to content

Commit

Permalink
Adjust login config variable and how env configuration is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Nov 19, 2024
1 parent d98469e commit 08f1462
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ There is an input form to give a PPN from K10plus catalogue.
- *Writing selected enrichment back to K10plus has not been implemented yet*

## Configuration
Currently not applicable, but will be relevant when a server component is added.

Configuration can be adjusted via a `.env` file. Variables prefixed with `VITE_` can be used in the client as well.

```env
# Base path on which your app will be hosted
BASE=/
# Login Server instance base URL
VITE_LOGIN_SERVER=http://localhost:3004
```

## To-Dos
- [ ] Code cleanup
Expand Down
3 changes: 1 addition & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const concordanceRegistry = cdk.initializeRegistry({
api: concordanceApi,
})

// eslint-disable-next-line no-undef
const loginServer = LOGIN_SERVER || null
const loginServer = import.meta.env.VITE_LOGIN_SERVER || null
export const loginServerUrl = loginServer && loginServer.replace(/https?:\/\//, "")
export const loginServerSsl = loginServer && loginServer.startsWith("https://")
7 changes: 0 additions & 7 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@ import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import { fileURLToPath } from "url"

import dotenv from "dotenv"
dotenv.config()

const base = process.env.BASE || "/"
const isProduction = process.env.NODE_ENV === "production"

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
define: {
BASE: `"${base || ""}"`,
LOGIN_SERVER: `"${process.env.LOGIN || ""}"`,
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
Expand Down

0 comments on commit 08f1462

Please sign in to comment.