Skip to content

Commit b6fec8b

Browse files
authored
feat(chore): caddy configuration conventions, better chain handling, cut on first error (#3)
1 parent c7fcbe8 commit b6fec8b

File tree

23 files changed

+878
-555
lines changed

23 files changed

+878
-555
lines changed

.github/workflows/static.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Static validation lint/tests
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
GO_VERSION: '1.25'
8+
9+
jobs:
10+
lint-validation:
11+
name: Validate Go code linting
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v5
16+
- name: Install Go
17+
uses: actions/setup-go@v6
18+
with:
19+
go-version: ${{ env.GO_VERSION }}
20+
- name: golangci-lint
21+
uses: golangci/golangci-lint-action@v8
22+
with:
23+
args: --timeout=240s
24+
unit-test-golang:
25+
needs: lint-validation
26+
name: Unit tests
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v5
31+
- name: Install Go
32+
uses: actions/setup-go@v6
33+
with:
34+
go-version: ${{ env.GO_VERSION }}
35+
- name: Run unit static tests
36+
run: go test -v -race

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.idea/
2+
13
caddy/caddy
24
**/plugin.wasm
35
node_modules/

.golangci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: "2"
2+
3+
issues:
4+
fix: true
5+
6+
run:
7+
timeout: 5m

.goreleaser.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
builds:
5+
- <<: &build_defaults
6+
ldflags:
7+
- -s -w
8+
env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
- windows
14+
goarch:
15+
- 386
16+
- amd64
17+
- arm
18+
- arm64
19+
ignore:
20+
- goos: windows
21+
goarch: arm64
22+
archives:
23+
-
24+
name_template: >-
25+
{{ .ProjectName }}_
26+
{{- title .Os }}_
27+
{{- if eq .Arch "amd64" }}x86_64
28+
{{- else if eq .Arch "386" }}i386
29+
{{- else }}{{ .Arch }}{{ end }}
30+
format_overrides:
31+
-
32+
goos: windows
33+
format: zip

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-tools:
66
cd tools/js && npm i && npm run build && npm login && npm publish
77

88
build-go:
9-
cd wasm && go mod tidy && tinygo build -o plugin.wasm -scheduler=asyncify --no-debug -target=wasi ./...
9+
cd demo/go && go mod tidy && tinygo build -o plugin.wasm -scheduler=asyncify --no-debug -target=wasi ./...
1010

1111
build-js:
1212
cd demo/js && npm i && ./node_modules/.bin/esbuild handler.js --bundle --outfile=dist.js && javy build dist.js -o index.wasm
@@ -17,5 +17,8 @@ caddy:
1717
debug: build-go
1818
go run main/main.go
1919

20+
lint:
21+
golangci-lint run -v ./...
22+
2023
run-caddy:
2124
cd caddy && ./caddy run

caddy/Caddyfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,16 @@
44

55
localhost {
66
wasm {
7-
item {
8-
filepath ../demo/go/plugin.wasm
9-
configuration {
10-
body_response "Bonjour! 🥖"
11-
}
12-
}
137
item {
148
filepath demo/php/index.php
159
builder php
16-
configuration {
17-
body_response "Bonjour! 🥖"
18-
}
1910
}
2011
item {
2112
filepath ../demo/js/index.wasm
2213
builder js
14+
}
15+
item {
16+
filepath ../demo/go/plugin.wasm
2317
configuration {
2418
body_response "Bonjour! 🥖"
2519
}

caddy/go.mod

Lines changed: 87 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -3,121 +3,136 @@ module github.com/darkweak/wazemmes/caddy
33
go 1.25
44

55
require (
6-
github.com/caddyserver/caddy/v2 v2.8.4
6+
github.com/caddyserver/caddy/v2 v2.10.2
77
github.com/darkweak/wazemmes v0.0.1
88
go.uber.org/zap v1.27.0
99
)
1010

1111
require (
12+
cel.dev/expr v0.24.0 // indirect
13+
cloud.google.com/go/auth v0.16.2 // indirect
14+
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
15+
cloud.google.com/go/compute/metadata v0.7.0 // indirect
16+
dario.cat/mergo v1.0.1 // indirect
1217
filippo.io/edwards25519 v1.1.0 // indirect
1318
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
19+
github.com/KimMachineGun/automemlimit v0.7.4 // indirect
1420
github.com/Masterminds/goutils v1.1.1 // indirect
15-
github.com/Masterminds/semver/v3 v3.2.0 // indirect
16-
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
21+
github.com/Masterminds/semver/v3 v3.3.0 // indirect
22+
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
1723
github.com/Microsoft/go-winio v0.6.0 // indirect
1824
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
1925
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b // indirect
2026
github.com/beorn7/perks v1.0.1 // indirect
21-
github.com/caddyserver/certmagic v0.21.3 // indirect
27+
github.com/caddyserver/certmagic v0.24.0 // indirect
2228
github.com/caddyserver/zerossl v0.1.3 // indirect
29+
github.com/ccoveille/go-safecast v1.6.1 // indirect
2330
github.com/cespare/xxhash v1.1.0 // indirect
24-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
31+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2532
github.com/chzyer/readline v1.5.1 // indirect
26-
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
33+
github.com/cloudflare/circl v1.6.1 // indirect
34+
github.com/coreos/go-oidc/v3 v3.14.1 // indirect
35+
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
2736
github.com/dgraph-io/badger v1.6.2 // indirect
2837
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
29-
github.com/dgraph-io/ristretto v0.1.0 // indirect
38+
github.com/dgraph-io/ristretto v0.2.0 // indirect
3039
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
3140
github.com/dustin/go-humanize v1.0.1 // indirect
32-
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
33-
github.com/go-kit/kit v0.13.0 // indirect
34-
github.com/go-kit/log v0.2.1 // indirect
35-
github.com/go-logfmt/logfmt v0.6.0 // indirect
36-
github.com/go-sql-driver/mysql v1.7.1 // indirect
37-
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
38-
github.com/golang/glog v1.2.0 // indirect
41+
github.com/felixge/httpsnoop v1.0.4 // indirect
42+
github.com/francoispqt/gojay v1.2.13 // indirect
43+
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
44+
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
45+
github.com/go-logr/logr v1.4.3 // indirect
46+
github.com/go-logr/stdr v1.2.2 // indirect
47+
github.com/go-sql-driver/mysql v1.8.1 // indirect
3948
github.com/golang/protobuf v1.5.4 // indirect
4049
github.com/golang/snappy v0.0.4 // indirect
41-
github.com/google/cel-go v0.20.1 // indirect
42-
github.com/google/pprof v0.0.0-20231212022811-ec68065c825e // indirect
50+
github.com/google/cel-go v0.26.0 // indirect
51+
github.com/google/s2a-go v0.1.9 // indirect
4352
github.com/google/uuid v1.6.0 // indirect
53+
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
54+
github.com/googleapis/gax-go/v2 v2.14.2 // indirect
4455
github.com/http-wasm/http-wasm-host-go v0.7.0 // indirect
45-
github.com/huandu/xstrings v1.3.3 // indirect
46-
github.com/imdario/mergo v0.3.12 // indirect
56+
github.com/huandu/xstrings v1.5.0 // indirect
4757
github.com/inconshreveable/mousetrap v1.1.0 // indirect
48-
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
49-
github.com/jackc/pgconn v1.14.3 // indirect
50-
github.com/jackc/pgio v1.0.0 // indirect
5158
github.com/jackc/pgpassfile v1.0.0 // indirect
52-
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
5359
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
54-
github.com/jackc/pgtype v1.14.0 // indirect
55-
github.com/jackc/pgx/v4 v4.18.3 // indirect
60+
github.com/jackc/pgx/v5 v5.6.0 // indirect
61+
github.com/jackc/puddle/v2 v2.2.1 // indirect
5662
github.com/jolestar/go-commons-pool/v2 v2.1.2 // indirect
5763
github.com/juliens/wasm-goexport v0.0.6 // indirect
58-
github.com/klauspost/compress v1.17.8 // indirect
59-
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
60-
github.com/libdns/libdns v0.2.2 // indirect
64+
github.com/klauspost/compress v1.18.0 // indirect
65+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
66+
github.com/libdns/libdns v1.1.0 // indirect
6167
github.com/manifoldco/promptui v0.9.0 // indirect
6268
github.com/mattn/go-colorable v0.1.13 // indirect
6369
github.com/mattn/go-isatty v0.0.20 // indirect
6470
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
65-
github.com/mholt/acmez/v2 v2.0.1 // indirect
66-
github.com/miekg/dns v1.1.59 // indirect
71+
github.com/mholt/acmez/v3 v3.1.2 // indirect
72+
github.com/miekg/dns v1.1.63 // indirect
6773
github.com/mitchellh/copystructure v1.2.0 // indirect
6874
github.com/mitchellh/go-ps v1.0.0 // indirect
6975
github.com/mitchellh/reflectwalk v1.0.2 // indirect
70-
github.com/onsi/ginkgo/v2 v2.13.2 // indirect
76+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
77+
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
7178
github.com/pkg/errors v0.9.1 // indirect
72-
github.com/prometheus/client_golang v1.19.1 // indirect
73-
github.com/prometheus/client_model v0.5.0 // indirect
74-
github.com/prometheus/common v0.48.0 // indirect
75-
github.com/prometheus/procfs v0.12.0 // indirect
76-
github.com/quic-go/qpack v0.4.0 // indirect
77-
github.com/quic-go/quic-go v0.44.0 // indirect
78-
github.com/rs/xid v1.5.0 // indirect
79+
github.com/prometheus/client_golang v1.23.0 // indirect
80+
github.com/prometheus/client_model v0.6.2 // indirect
81+
github.com/prometheus/common v0.65.0 // indirect
82+
github.com/prometheus/procfs v0.16.1 // indirect
83+
github.com/quic-go/qpack v0.5.1 // indirect
84+
github.com/quic-go/quic-go v0.54.0 // indirect
85+
github.com/rs/xid v1.6.0 // indirect
7986
github.com/russross/blackfriday/v2 v2.1.0 // indirect
80-
github.com/shopspring/decimal v1.2.0 // indirect
87+
github.com/shopspring/decimal v1.4.0 // indirect
8188
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
82-
github.com/slackhq/nebula v1.6.1 // indirect
83-
github.com/smallstep/certificates v0.26.1 // indirect
84-
github.com/smallstep/nosql v0.6.1 // indirect
85-
github.com/smallstep/pkcs7 v0.0.0-20231024181729-3b98ecc1ca81 // indirect
86-
github.com/smallstep/scep v0.0.0-20231024192529-aee96d7ad34d // indirect
89+
github.com/slackhq/nebula v1.9.5 // indirect
90+
github.com/smallstep/certificates v0.28.4 // indirect
91+
github.com/smallstep/cli-utils v0.12.1 // indirect
92+
github.com/smallstep/linkedca v0.23.0 // indirect
93+
github.com/smallstep/nosql v0.7.0 // indirect
94+
github.com/smallstep/pkcs7 v0.2.1 // indirect
95+
github.com/smallstep/scep v0.0.0-20240926084937-8cf1ca453101 // indirect
8796
github.com/smallstep/truststore v0.13.0 // indirect
88-
github.com/spf13/cast v1.4.1 // indirect
89-
github.com/spf13/cobra v1.8.0 // indirect
90-
github.com/spf13/pflag v1.0.5 // indirect
97+
github.com/spf13/cast v1.7.0 // indirect
98+
github.com/spf13/cobra v1.9.1 // indirect
99+
github.com/spf13/pflag v1.0.7 // indirect
91100
github.com/stealthrocket/wasi-go v0.8.0 // indirect
92101
github.com/stealthrocket/wazergo v0.19.1 // indirect
93102
github.com/stoewer/go-strcase v1.2.0 // indirect
94-
github.com/tailscale/tscert v0.0.0-20240517230440-bbccfbf48933 // indirect
95-
github.com/tetratelabs/wazero v1.8.1 // indirect
96-
github.com/urfave/cli v1.22.14 // indirect
97-
github.com/zeebo/blake3 v0.2.3 // indirect
98-
go.etcd.io/bbolt v1.3.9 // indirect
99-
go.step.sm/cli-utils v0.9.0 // indirect
100-
go.step.sm/crypto v0.45.0 // indirect
101-
go.step.sm/linkedca v0.20.1 // indirect
102-
go.uber.org/automaxprocs v1.5.3 // indirect
103-
go.uber.org/mock v0.4.0 // indirect
103+
github.com/tailscale/tscert v0.0.0-20240608151842-d3f834017e53 // indirect
104+
github.com/tetratelabs/wazero v1.9.0 // indirect
105+
github.com/urfave/cli v1.22.17 // indirect
106+
github.com/zeebo/blake3 v0.2.4 // indirect
107+
go.etcd.io/bbolt v1.3.10 // indirect
108+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
109+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
110+
go.opentelemetry.io/otel v1.37.0 // indirect
111+
go.opentelemetry.io/otel/metric v1.37.0 // indirect
112+
go.opentelemetry.io/otel/trace v1.37.0 // indirect
113+
go.step.sm/crypto v0.67.0 // indirect
114+
go.uber.org/automaxprocs v1.6.0 // indirect
115+
go.uber.org/mock v0.5.2 // indirect
104116
go.uber.org/multierr v1.11.0 // indirect
105-
go.uber.org/zap/exp v0.2.0 // indirect
106-
golang.org/x/crypto v0.23.0 // indirect
107-
golang.org/x/crypto/x509roots/fallback v0.0.0-20240507223354-67b13616a595 // indirect
108-
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
109-
golang.org/x/mod v0.17.0 // indirect
110-
golang.org/x/net v0.25.0 // indirect
111-
golang.org/x/sync v0.7.0 // indirect
112-
golang.org/x/sys v0.20.0 // indirect
113-
golang.org/x/term v0.20.0 // indirect
114-
golang.org/x/text v0.15.0 // indirect
115-
golang.org/x/time v0.5.0 // indirect
116-
golang.org/x/tools v0.21.0 // indirect
117-
google.golang.org/genproto/googleapis/api v0.0.0-20240506185236-b8a5c65736ae // indirect
118-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240429193739-8cf5692501f6 // indirect
119-
google.golang.org/grpc v1.63.2 // indirect
120-
google.golang.org/protobuf v1.34.1 // indirect
117+
go.uber.org/zap/exp v0.3.0 // indirect
118+
golang.org/x/crypto v0.40.0 // indirect
119+
golang.org/x/crypto/x509roots/fallback v0.0.0-20250305170421-49bf5b80c810 // indirect
120+
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
121+
golang.org/x/mod v0.25.0 // indirect
122+
golang.org/x/net v0.42.0 // indirect
123+
golang.org/x/oauth2 v0.30.0 // indirect
124+
golang.org/x/sync v0.16.0 // indirect
125+
golang.org/x/sys v0.34.0 // indirect
126+
golang.org/x/term v0.33.0 // indirect
127+
golang.org/x/text v0.27.0 // indirect
128+
golang.org/x/time v0.12.0 // indirect
129+
golang.org/x/tools v0.34.0 // indirect
130+
google.golang.org/api v0.240.0 // indirect
131+
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect
132+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
133+
google.golang.org/grpc v1.73.0 // indirect
134+
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
135+
google.golang.org/protobuf v1.36.6 // indirect
121136
gopkg.in/yaml.v3 v3.0.1 // indirect
122137
howett.net/plist v1.0.0 // indirect
123138
)

0 commit comments

Comments
 (0)