summaryrefslogtreecommitdiffhomepage
path: root/vhosts/blog/nuldoc-src/config.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-06-27 23:39:31 +0900
committernsfisis <nsfisis@gmail.com>2025-06-27 23:39:31 +0900
commit674fe965550444db87edc7937ff6932e1a918d9d (patch)
treee8a80dd958d3e082485286bf5785a7992b6e6b0e /vhosts/blog/nuldoc-src/config.ts
parentfe4d1d625b53796c5f20399790e5ff8c7a7e1608 (diff)
downloadnsfisis.dev-674fe965550444db87edc7937ff6932e1a918d9d.tar.gz
nsfisis.dev-674fe965550444db87edc7937ff6932e1a918d9d.tar.zst
nsfisis.dev-674fe965550444db87edc7937ff6932e1a918d9d.zip
feat(meta): rename vhosts/ directory to services/
Diffstat (limited to 'vhosts/blog/nuldoc-src/config.ts')
-rw-r--r--vhosts/blog/nuldoc-src/config.ts41
1 files changed, 0 insertions, 41 deletions
diff --git a/vhosts/blog/nuldoc-src/config.ts b/vhosts/blog/nuldoc-src/config.ts
deleted file mode 100644
index adcb5632..00000000
--- a/vhosts/blog/nuldoc-src/config.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { join } from "@std/path";
-import { parse as parseToml } from "@std/toml";
-import { z } from "zod/mod.ts";
-
-const ConfigSchema = z.object({
- locations: z.object({
- contentDir: z.string(),
- destDir: z.string(),
- staticDir: z.string(),
- }),
- rendering: z.object({
- html: z.object({
- indentWidth: z.number(),
- }),
- }),
- blog: z.object({
- author: z.string(),
- fqdn: z.string(),
- siteName: z.string(),
- siteCopyrightYear: z.number(),
- postsPerPage: z.number().default(10),
- tagLabels: z.record(z.string(), z.string()),
- }),
-});
-
-export type Config = z.infer<typeof ConfigSchema>;
-
-export function getTagLabel(c: Config, slug: string): string {
- if (!(slug in c.blog.tagLabels)) {
- throw new Error(`Unknown tag: ${slug}`);
- }
- return c.blog.tagLabels[slug];
-}
-
-export function getDefaultConfigPath(): string {
- return join(Deno.cwd(), "nuldoc.toml");
-}
-
-export async function loadConfig(filePath: string): Promise<Config> {
- return ConfigSchema.parse(parseToml(await Deno.readTextFile(filePath)));
-}