Skip to content

Commit 0b17375

Browse files
committed
chore: test env vars
Signed-off-by: Alessandro Yuichi Okimoto <yuichijpn@gmail.com>
1 parent d4a7914 commit 0b17375

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

ui/dashboard/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@ dev:
1414
.PHONY: build
1515
build:
1616
VITE_RELEASE_CHANNEL=prod \
17-
VITE_DEMO_SIGN_IN_ENABLED=true \
18-
VITE_DEMO_SIGN_IN_EMAIL=demo@bucketeer.io \
19-
VITE_DEMO_SIGN_IN_PASSWORD=demo \
2017
yarn build

ui/dashboard/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</head>
99

1010
<body>
11+
<script src="/static/js/env.js"></script>
1112
<div id="root"></div>
1213
<script type="module" src="/src/main.tsx"></script>
1314
</body>

ui/dashboard/src/configs/index.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ export const tailwindConfig = resolveConfig(customTailwindConfig);
55

66
const releaseMode = import.meta.env.VITE_RELEASE_CHANNEL;
77

8+
declare global {
9+
interface Window {
10+
env: {
11+
DEMO_SIGN_IN_ENABLED?: boolean;
12+
DEMO_SIGN_IN_EMAIL?: string;
13+
VITE_DEMO_SIGN_IN_PASSWORD?: string;
14+
GOOGLE_TAG_MANAGER_ID?: string;
15+
};
16+
}
17+
}
18+
819
export const urls = {
920
GRPC: releaseMode !== 'prod' ? import.meta.env.VITE_WEB_API_ENDPOINT : '',
1021
AUTH_REDIRECT:
@@ -13,6 +24,19 @@ export const urls = {
1324
: `${window.location.origin}/auth/callback`
1425
};
1526

16-
export const DEMO_SIGN_IN_ENABLED = import.meta.env.VITE_DEMO_SIGN_IN_ENABLED;
17-
export const DEMO_SIGN_IN_EMAIL = import.meta.env.VITE_DEMO_SIGN_IN_EMAIL;
18-
export const DEMO_SIGN_IN_PASSWORD = import.meta.env.VITE_DEMO_SIGN_IN_PASSWORD;
27+
export const GOOGLE_TAG_MANAGER_ID = window.env?.GOOGLE_TAG_MANAGER_ID || '';
28+
29+
export const DEMO_SIGN_IN_ENABLED =
30+
releaseMode !== 'prod'
31+
? import.meta.env.VITE_DEMO_SIGN_IN_ENABLED
32+
: window.env?.DEMO_SIGN_IN_ENABLED;
33+
34+
export const DEMO_SIGN_IN_EMAIL =
35+
releaseMode !== 'prod'
36+
? import.meta.env.VITE_DEMO_SIGN_IN_EMAIL
37+
: window.env?.DEMO_SIGN_IN_EMAIL;
38+
39+
export const DEMO_SIGN_IN_PASSWORD =
40+
releaseMode !== 'prod'
41+
? import.meta.env.VITE_DEMO_SIGN_IN_ENABLED
42+
: window.env?.VITE_DEMO_SIGN_IN_PASSWORD;

0 commit comments

Comments
 (0)