mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-18 11:06:19 +00:00
* feat: gate agent alpha UI behind capabilities * fix: provide chat session for non-alpha home * fix: gate agents page behind alpha * fix: enable alpha capabilities in development
37 lines
976 B
TypeScript
37 lines
976 B
TypeScript
import { ZodError, z } from 'zod'
|
|
|
|
const EnvSchema = z.object({
|
|
VITE_BROWSEROS_SERVER_PORT: z.coerce.number().optional(),
|
|
VITE_ALPHA_FEATURES: z
|
|
.string()
|
|
.optional()
|
|
.transform((value) => value === 'true'),
|
|
VITE_PUBLIC_POSTHOG_KEY: z.string().optional(),
|
|
VITE_PUBLIC_POSTHOG_HOST: z.string().optional(),
|
|
VITE_PUBLIC_SENTRY_DSN: z.string().optional(),
|
|
VITE_PUBLIC_BROWSEROS_API: z.string().optional(),
|
|
PROD: z.boolean().optional().default(false),
|
|
})
|
|
|
|
try {
|
|
EnvSchema.parse(import.meta.env)
|
|
} catch (error) {
|
|
if (error instanceof ZodError) {
|
|
let message = 'Missing required values in .env:\n'
|
|
for (const issue of error.issues) {
|
|
message += `${issue.path.join('.')}\n`
|
|
}
|
|
const e = new Error(message)
|
|
e.stack = ''
|
|
throw e
|
|
}
|
|
// biome-ignore lint/suspicious/noConsole: allowed to display error information
|
|
console.error(error)
|
|
throw error
|
|
}
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const env = EnvSchema.parse(import.meta.env)
|