Add the site config type

This commit is contained in:
Dave Smith-Hayes 2024-10-22 20:50:47 -04:00
parent c8b5f72657
commit ab5a83202e

View File

@ -1,10 +1,24 @@
import TOML from 'smol-toml';
import { CONFIG_PATH } from '@blog/config';
export async function getSiteConfig() {
export type SiteConfig = {
title: string;
owner: {
name: string;
email: string;
};
site: {
description: string;
url: string;
repo: string;
language: string;
copyright: string;
}
}
export async function getSiteConfig(): Promise<SiteConfig> {
const siteConfig = CONFIG_PATH + '/site.toml';
const file = Bun.file(siteConfig);
const data = await file.text();
return TOML.parse(data);
return TOML.parse(data) as SiteConfig;
}