-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.ts
More file actions
34 lines (28 loc) · 1.21 KB
/
env.ts
File metadata and controls
34 lines (28 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import {
Schema,
defineConfig,
overrideDefineForWebAppServe,
} from '@togglecorp/vite-plugin-validate-env';
const webAppServeEnabled = process.env.WEB_APP_SERVE_ENABLED?.toLowerCase() === 'true';
const urlStringOptions: Parameters<typeof Schema.string>[number] = {
format: 'url',
protocol: true,
tld: false,
};
// TODO: Integrate .env for CI and remove optional() call on required fields
export default defineConfig({
validator: 'builtin',
schema: {
APP_ENVIRONMENT: Schema.enum.optional(['DEV', 'CI', 'ALPHA', 'STAGE', 'PROD'] as const),
APP_REST_API_DOMAIN: Schema.string(urlStringOptions),
APP_GRAPHQL_API_DOMAIN: Schema.string(urlStringOptions),
APP_SENTRY_DSN: Schema.string.optional(),
APP_SENTRY_TRACES_SAMPLE_RATE: Schema.string.optional(),
APP_FIREBASE_API_KEY: Schema.string.optional(),
APP_FIREBASE_AUTH_DOMAIN: Schema.string.optional(),
APP_FIREBASE_PROJECT_ID: Schema.string.optional(),
APP_FIREBASE_AUTH_EMULATOR_URL: Schema.string.optional(urlStringOptions),
APP_MAPILLARY_API_KEY: Schema.string.optional(),
},
overrideDefine: webAppServeEnabled ? overrideDefineForWebAppServe : undefined,
})