forked from blcham/record-manager-ui
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from akaene/feature/final-vite-migration
[feature] final vite migration
- Loading branch information
Showing
19 changed files
with
1,315 additions
and
7,297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
RECORD_MANAGER_API_URL=http://localhost:1235/record-manager/services/record-manager-server | ||
RECORD_MANAGER_APP_TITLE=Record Manager | ||
RECORD_MANAGER_APP_INFO= | ||
RECORD_MANAGER_LANGUAGE=cs | ||
RECORD_MANAGER_NAVIGATOR_LANGUAGE=true | ||
RECORD_MANAGER_BASENAME=/ | ||
RECORD_MANAGER_EXTENSIONS=supplier | ||
RECORD_MANAGER_AUTHENTICATION=internal | ||
RECORD_MANAGER_AUTH_SERVER_URL= | ||
RECORD_MANAGER_AUTH_CLIENT_ID=record-manager-ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
RECORD_MANAGER_API_URL=http://localhost:1235/record-manager/services/record-manager-server | ||
RECORD_MANAGER_APP_TITLE=Record Manager | ||
RECORD_MANAGER_APP_INFO= | ||
RECORD_MANAGER_LANGUAGE=cs | ||
RECORD_MANAGER_NAVIGATOR_LANGUAGE=true | ||
RECORD_MANAGER_BASENAME=/ | ||
RECORD_MANAGER_EXTENSIONS=supplier | ||
RECORD_MANAGER_AUTHENTICATION=internal | ||
RECORD_MANAGER_AUTH_SERVER_URL= | ||
RECORD_MANAGER_AUTH_CLIENT_ID=record-manager-ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
*.iml | ||
node_modules | ||
build | ||
dist | ||
coverage | ||
junit.xml | ||
.DS_store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,37 @@ | ||
/** | ||
* Aggregated object of process.env and window.__config__ to allow dynamic configuration | ||
*/ | ||
|
||
const viteEnvPrefix = "RECORD_MANAGER_"; | ||
const ENV = { | ||
...Object.keys(process.env).reduce((acc, key) => { | ||
const strippedKey = key.replace("RECORD_MANAGER_", ""); | ||
acc[strippedKey] = process.env[key]; | ||
return acc; | ||
}, {}), | ||
...(window).__config__, | ||
...Object.keys(import.meta.env).reduce((acc, key) => { | ||
if (key.startsWith(viteEnvPrefix)) { | ||
const strippedKey = key.replace(viteEnvPrefix, ""); | ||
acc[strippedKey] = import.meta.env[key]; | ||
} | ||
return acc; | ||
}, {}), | ||
...window.__config__, | ||
}; | ||
|
||
/** | ||
* Helper to make sure that all envs are defined properly | ||
* @param name env variable name | ||
* @param defaultValue Default variable name | ||
*/ | ||
export const getEnv = (name, defaultValue) => { | ||
const value = ENV[name] || defaultValue; | ||
if (value !== undefined) { | ||
return value; | ||
} | ||
throw new Error(`Missing environment variable: ${name}`); | ||
const value = ENV[name] || defaultValue; | ||
if (value !== undefined) { | ||
return value; | ||
} | ||
throw new Error(`Missing environment variable: ${name}`); | ||
}; | ||
|
||
export const API_URL = getEnv("API_URL"); | ||
export const APP_TITLE = getEnv("APP_TITLE", "Record Manager"); | ||
export const LANGUAGE = getEnv("LANGUAGE", "en"); | ||
export const NAVIGATOR_LANGUAGE = JSON.parse(getEnv("NAVIGATOR_LANGUAGE", "true")); | ||
export const NAVIGATOR_LANGUAGE = JSON.parse( | ||
getEnv("NAVIGATOR_LANGUAGE", "true") | ||
); | ||
export const BASENAME = getEnv("BASENAME", ""); | ||
export const EXTENSIONS = getEnv("EXTENSIONS", ""); | ||
export const EXTENSIONS = getEnv("EXTENSIONS", ""); | ||
export const APP_INFO = getEnv("APP_INFO", "© KBSS at FEE CTU in Prague, 2024"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head lang="en"> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="favicon.ico" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1, user-scalable=0" | ||
/> | ||
<script src="config.js"></script> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="src/index.jsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.