-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend: use vite's mechanism for env variables to fill window.envir…
…onment That we don't have locally cached environment.js files breaking the development setup. Sadly we still use vue-cli to run our tests, so there the vite mechanism does not work and we have to maintain one additional environment.js. In production, we compose the environment.js anyway in the configmap, thus we don't have to consider the production case in dev-environment.js. Now we can also remove the check in index.html. In a production environment, you have to check yourself that you have all the needed configurations set. closes #3267
- Loading branch information
Showing
8 changed files
with
30 additions
and
78 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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
/** | ||
* This is a placeholder. | ||
* In production, this file is filled with the values for window.environment. | ||
* In development, window.environment is filled in src/dev-environment.js | ||
*/ |
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,21 @@ | ||
// you can overwrite the env variables locally in frontend/env.local | ||
// @see https://vitejs.dev/guide/env-and-mode.html | ||
if (!window.environment) { | ||
const env = import.meta.env | ||
window.environment = { | ||
API_ROOT_URL: env.VITE_API_ROOT_URL ?? 'http://localhost:3001', | ||
COOKIE_PREFIX: env.VITE_COOKIE_PREFIX ?? 'localhost_', | ||
PRINT_URL: env.VITE_PRINT_URL ?? 'http://localhost:3003', | ||
SENTRY_FRONTEND_DSN: env.VITE_SENTRY_FRONTEND_DSN, | ||
SENTRY_ENVIRONMENT: env.VITE_SENTRY_ENVIRONMENT ?? 'http://localhost:3000', | ||
SHARED_COOKIE_DOMAIN: env.VITE_SHARED_COOKIE_DOMAIN ?? 'localhost', | ||
DEPLOYMENT_TIME: env.VITE_DEPLOYMENT_TIME ?? '', | ||
VERSION: env.VITE_VERSION ?? '', | ||
VERSION_LINK_TEMPLATE: | ||
env.VITE_VERSION_LINK_TEMPLATE ?? | ||
'https://github.com/ecamp/ecamp3/commit/{version}', | ||
FEATURE_DEVELOPER: env.VITE_FEATURE_DEVELOPER ?? true, | ||
LOGIN_INFO_TEXT_KEY: env.VITE_LOGIN_INFO_TEXT_KEY ?? 'dev', | ||
} | ||
} | ||
export const getEnv = () => window.environment |
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