Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

876 B
Raw Blame
import { z } from "zod";

const stringBool = (defaultValue: string) =>
  z
    .string()
    .prefault(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"),
    RESTATE_DISPATCHER_INACTIVITY_TIMEOUT_SECS: z.coerce.number().default(10),
  })
  .parse(process.env);