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

1.0 KB · 32 lines · Go Raw History
 1package main
 2
 3import "strings"
 4
 5// Identity is hardcoded, never configured: an empty BASE_URL would ship a site
 6// whose own tracking silently did nothing. There are no environment variables
 7// left at all now that signing in happens on auth.bythewood.me.
 8const (
 9	baseURL    = "https://analytics.bythewood.me"
10	siteName   = "Analytics"
11	authorName = "Isaac Bythewood"
12	githubUser = "overshard"
13
14	// Identity, not a credential: this id is in the page source by design.
15	analyticsID = "580ebab0-3d14-4a20-89da-d57fc3d7d9e8"
16)
17
18// Staging is true on any hostname but the real one; it drives the noindex, the
19// robots.txt Disallow and self-tracking.
20var Staging = !strings.HasSuffix(baseURL, "//analytics.bythewood.me")
21
22// collectorID is empty on staging, so the snippet renders nothing rather than
23// posting an id that database has no row for.
24func collectorID() string {
25	if Staging {
26		return ""
27	}
28	return analyticsID
29}
30
31const sourceURL = "https://github.com/" + githubUser + "/orchard/tree/main/sites/analytics.bythewood.me"