aboutsummaryrefslogtreecommitdiffstats
path: root/packages/plugins/queue-restate/src/env.ts
blob: abcfbe512aa99aec939f2500df101ccfe6675b4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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"),
  })
  .parse(process.env);