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
1package main
2
3import (
4 "os"
5 "testing"
6)
7
8// TestOneSearch spends exactly one real search, so it is off by default. A test
9// run that quietly burns search allowance is how you end up rate limited
10// without knowing why.
11//
12// SEARCH_LIVE=1 go test -run TestOneSearch -v .
13func TestOneSearch(t *testing.T) {
14 if os.Getenv("SEARCH_LIVE") == "" {
15 t.Skip("set SEARCH_LIVE=1 to spend one real search")
16 }
17 res, err := SearchDDG(newHTTPClient(), "sqlite wal mode", 5)
18 if err != nil {
19 t.Fatalf("search: %v", err)
20 }
21 if len(res) == 0 {
22 t.Fatal("no results parsed, the markup may have changed")
23 }
24 for i, r := range res {
25 t.Logf(" %d. %s | %s", i+1, r.Title, r.URL)
26 }
27}