orchard
mirrorEvery 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
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, or embed skips every entry whose name starts with a dot,
13// and .vite/manifest.json is one, so the server would refuse to start on a
14// manifest it could not find.
15//
16//go:embed all:build/dist
17var buildFS embed.FS
18
19func distFS() fs.FS {
20 sub, err := fs.Sub(buildFS, "build/dist")
21 if err != nil {
22 slog.Error("startup failed", slog.Any("err", err))
23 os.Exit(1)
24 }
25 return sub
26}