all repos — website @ 78439b16cc66532225e75c9aa40cf7c49cddc22d

My website

Read config from TOML file

Alan Pearce
commit

78439b16cc66532225e75c9aa40cf7c49cddc22d

parent

b45b4e37af14d94726b0c5d2691289886c0527cf

1 file changed, 8 insertions(+), 2 deletions(-)

changed files
M src/index.tssrc/index.ts
@@ -1,10 +1,16 @@
+import path from "node:path"; import { withHtmlLiveReload } from "bun-html-live-reload"; import serveStatic from "serve-static-bun"; -const dir = Bun.argv.length > 2 ? Bun.argv[Bun.argv.length - 1] : "./"; +import readConfig from "./config"; + +const base = Bun.argv.length > 2 ? Bun.argv[Bun.argv.length - 1] : "."; + +const config = readConfig(base); export default withHtmlLiveReload({ - fetch: serveStatic(dir, { + fetch: serveStatic(path.join(base, "public"), { + headers: config.extra.headers, dotfiles: "allow", }), });