You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
617 B
TypeScript

import { object, record, string, literal, number } from "../common/deps/zod.ts";
const HttpService = object({
type: literal("http"),
url: string(),
publicUrl: string().optional(),
});
export const Configuration = object({
hostname: string().optional(),
port: number().optional(),
title: string().optional(),
description: string().optional(),
hosts: record(string()),
services: record(HttpService),
});
export const load = async () => {
const contents = await Deno.readTextFile("./config.json");
const json = JSON.parse(contents);
const config = await Configuration.parseAsync(json);
return config;
}