repos
/ orchard main

orchard

mirror

Every site I host, in one repo, along with the Cloudflare Tunnel and Caddy that front them. It's all Go, Vite, and SQLite, and it runs on a desktop at home with nothing listening on an inbound port.

blogbuncaddycloudflare-tunneldockergogolanghomelabhtml-templatemonorepoself-hostedseosqlitestatic-sitetypstuptime-monitoringviteweb-analytics

426 B · 26 lines · Go Raw History
 1//go:build embed
 2
 3package main
 4
 5import (
 6	"embed"
 7	"io/fs"
 8	"log/slog"
 9	"os"
10)
11
12// `all:` is required: without it embed skips dotted entries, and
13// .vite/manifest.json is one, so the server would refuse to start.
14//
15//go:embed all:build/dist
16var buildFS embed.FS
17
18func distFS() fs.FS {
19	f, err := fs.Sub(buildFS, "build/dist")
20	if err != nil {
21		slog.Error("startup failed", slog.Any("err", err))
22		os.Exit(1)
23	}
24	return f
25}