Skip to content

Commit a656707

Browse files
committed
Get dbkey and examples from config
1 parent bd66223 commit a656707

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Configuration can be adjusted via a `.env` file. Variables prefixed with `VITE_`
5757
PORT=3454
5858
# Full base URL on which your app will be hosted
5959
BASE_URL=https://coli-conc.gbv.de/coli-rich/app/
60+
# Database key
61+
DBKEY=opac-de-627
6062
# Login Server instance base URL
6163
VITE_LOGIN_SERVER=http://localhost:3004
6264
# Hardcoded list of allowed user URIs that can perform enrichments in the backend

src/client/config.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Vite supports JSON import without assertions
22
import pkg from "#/package.json"
33
const { name, version, description } = pkg
4+
const { env } = import.meta
45

56
export {
67
name,
@@ -29,18 +30,18 @@ export const concordanceRegistry = cdk.initializeRegistry({
2930
api: concordanceApi,
3031
})
3132

32-
const loginServer = import.meta.env.VITE_LOGIN_SERVER || null
33+
const loginServer = env.VITE_LOGIN_SERVER || null
3334
export const loginServerUrl = loginServer && loginServer.replace(/https?:\/\//, "")
3435
export const loginServerSsl = loginServer && loginServer.startsWith("https://")
3536

36-
export const allowedUsers = (import.meta.env.VITE_ALLOWED_USERS || "").split(",").filter(Boolean).map(uri => uri.trim())
37-
export const allowedProviders = (import.meta.env.VITE_ALLOWED_PROVIDERS || "").split(",").filter(Boolean).map(uri => uri.trim())
37+
export const allowedUsers = (env.VITE_ALLOWED_USERS || "").split(",").filter(Boolean).map(uri => uri.trim())
38+
export const allowedProviders = (env.VITE_ALLOWED_PROVIDERS || "").split(",").filter(Boolean).map(uri => uri.trim())
3839

39-
export const baseUrl = import.meta.env.BASE_URL || "/"
40-
export const isProduction = import.meta.env.MODE === "production"
40+
export const baseUrl = env.BASE_URL || "/"
41+
export const isProduction = env.MODE === "production"
4142

42-
export const dbKey = isProduction ? "opac-de-627" : "test-k10plus"
43-
export const examples = isProduction ? [ "389598534", "1830228498", "1646529499" ] : []
43+
export const dbKey = env.DBKEY || "opac-de-627"
44+
export const examples = (env.EXAMPLES || "").split(",")
4445

4546
let _additionalText = import.meta.env.VITE_ADDITIONAL_TEXT || null
4647
// If the additional text is not enclosed in a HTML tag, use <p></p>

0 commit comments

Comments
 (0)