all repos — stealth-developers @ 942b59086bd65d148059f36b6c026083aea4dc34

pkgs/config/src/schema.ts (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
import z from "zod";
import { ENVIRONMENT, IS_PROD } from ".";

const discordSchema = z.object({
  token: z.string(),
  app_id: z.string(),
  client_secret: z.string(),
});

const dbSchema = z.object({
  url: z.string(),
  auth: z.string(),
});

const schema = z
  .object({
    discord: discordSchema,
    db: dbSchema,
  })
  .transform((config) => {
    return {
      ...config,
      environment: ENVIRONMENT,
      isProd: IS_PROD,
    };
  });

export default schema;
export type Config = z.infer<typeof schema>;