mirror of
https://github.com/velocitatem/PHANTOM.git
synced 2026-07-15 17:43:36 +00:00
* chore: cleaning gitignore * formating and env documentation * feat: context switching of hotel/airline depndent on env var via middleware * fixed alignment and building * wrong file * prods * fixed applying style * better session cookie management * tentative session storage with maybe using airtable * migrated api of ingestion * events and products apge * fixing build * 13 create outline for research paper draft (#18) * updated outline for paper from issue * extra paper sections and some formalization of series data * algorithms and acknowledgements * updated outline for paper from issue * upadted text formating * event unification * refactor tracking to ues callbacks instead of refs * implement a pricing display api with session passing * moved middleware to proxy according to new changes in Nextjs * refactoed kafka ingestion to go via backend not web-db * Refactor docker-compose services to use individual Dockerfiles (#20) * Initial plan * Refactor services into individual Dockerfiles Co-authored-by: velocitatem <60182044+velocitatem@users.noreply.github.com> * Add EXPOSE directives to all Dockerfiles with port documentation Co-authored-by: velocitatem <60182044+velocitatem@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: velocitatem <60182044+velocitatem@users.noreply.github.com> * fixing small bugs and adding exepriments to tracking * added some doc
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
type Env = z.infer<typeof envSchema>;
|
|
const envSchema = z.object({
|
|
STORE_MODE: z.enum(['hotel', 'airline'], {
|
|
message: 'STORE_MODE must be either "hotel" or "airline"'
|
|
}),
|
|
NEXT_PUBLIC_API_BASE: z.string().url({
|
|
message: 'NEXT_PUBLIC_API_BASE must be a valid URL (e.g., http://localhost:3000)'
|
|
}),
|
|
NEXT_PUBLIC_APP_ENV: z.enum(['dev', 'prod'], {
|
|
message: 'NEXT_PUBLIC_APP_ENV must be either "dev" or "prod"'
|
|
}),
|
|
});
|
|
|
|
// parse and validate env at module load, fail fast with descriptive errors
|
|
const parseEnv = (): Env => {
|
|
const result = envSchema.safeParse({
|
|
STORE_MODE: process.env.STORE_MODE,
|
|
NEXT_PUBLIC_API_BASE: process.env.NEXT_PUBLIC_API_BASE,
|
|
NEXT_PUBLIC_APP_ENV: process.env.NEXT_PUBLIC_APP_ENV,
|
|
});
|
|
if (!result.success) {
|
|
const errors = result.error.issues.map((err) => `${err.path.join('.')}: ${err.message}`).join('\n');
|
|
throw new Error(`Environment validation failed:\n${errors}`);
|
|
}
|
|
return result.data;
|
|
};
|
|
|
|
export const config: Env = parseEnv();
|