aboutsummaryrefslogtreecommitdiffstats
path: root/packages/plugins/queue-restate/src/env.ts
blob: 41003460818d53bfd89f41ea4cd7d3ce9b68a092 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { z } from "zod";

const stringBool = (defaultValue: string) =>
  z
    .string()
    .default(defaultValue)
    .refine((s) => s === "true" || s === "false")
    .transform((s) => s === "true");

export const envConfig = z
  .object({
    RESTATE_LISTEN_PORT: z.coerce.number().optional(),
    RESTATE_INGRESS_ADDR: z
      .string()
      .optional()
      .default("http://localhost:8080"),
    RESTATE_ADMIN_ADDR: z.string().optional().default("http://localhost:9070"),
    RESTATE_PUB_KEY: z.string().optional(),
    RESTATE_EXPOSE_CORE_SERVICES: stringBool("true"),
    // Deployment mode configuration - allows running dispatchers and runners separately
    RESTATE_ENABLE_DISPATCHERS: stringBool("true"),
    RESTATE_ENABLE_RUNNERS: stringBool("true"),
  })
  .parse(process.env);