Skip to content

Commit eb44602

Browse files
committed
make POST endpoint optional
1 parent d0b847a commit eb44602

8 files changed

Lines changed: 172 additions & 31 deletions

File tree

caddy/app.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ func (f *FrankenPHPApp) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
254254

255255
f.Workers = append(f.Workers, wc)
256256
default:
257-
allowedDirectives := "num_threads, max_threads, php_ini, worker, max_wait_time"
258-
return wrongSubDirectiveError("frankenphp", allowedDirectives, d.Val())
257+
return wrongSubDirectiveError("frankenphp", "num_threads, max_threads, php_ini, worker, max_wait_time", d.Val())
259258
}
260259
}
261260
}

caddy/caddy.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/caddyserver/caddy/v2"
1010
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
11+
caddyMercure "github.com/dunglas/mercure/caddy"
1112
)
1213

1314
const (
@@ -16,6 +17,8 @@ const (
1617
)
1718

1819
func init() {
20+
caddyMercure.AllowNoPublish = true
21+
1922
caddy.RegisterModule(FrankenPHPApp{})
2023
caddy.RegisterModule(FrankenPHPModule{})
2124
caddy.RegisterModule(FrankenPHPAdmin{})
@@ -29,7 +32,7 @@ func init() {
2932
httpcaddyfile.RegisterDirectiveOrder("php_server", "before", "file_server")
3033
}
3134

32-
// return a nice error message
33-
func wrongSubDirectiveError(module string, allowedDriectives string, wrongValue string) error {
34-
return fmt.Errorf("unknown '%s' subdirective: '%s' (allowed directives are: %s)", module, wrongValue, allowedDriectives)
35+
// wrongSubDirectiveError returns a nice error message.s
36+
func wrongSubDirectiveError(module string, allowedDirectives string, wrongValue string) error {
37+
return fmt.Errorf("unknown %q subdirective: %s (allowed directives are: %s)", module, wrongValue, allowedDirectives)
3538
}

caddy/go.mod

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ module github.com/dunglas/frankenphp/caddy
22

33
go 1.25.0
44

5+
replace (
6+
github.com/dunglas/mercure => ../../mercure
7+
github.com/dunglas/mercure/caddy => ../../mercure/caddy
8+
)
9+
510
replace github.com/dunglas/frankenphp => ../
611

712
retract v1.0.0-rc.1 // Human error
@@ -21,7 +26,7 @@ require (
2126
require github.com/smallstep/go-attestation v0.4.4-0.20241119153605-2306d5b464ca // indirect
2227

2328
require (
24-
cel.dev/expr v0.24.0 // indirect
29+
cel.dev/expr v0.25.0 // indirect
2530
cloud.google.com/go/auth v0.17.0 // indirect
2631
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
2732
cloud.google.com/go/compute/metadata v0.9.0 // indirect
@@ -38,6 +43,7 @@ require (
3843
github.com/MicahParks/keyfunc/v3 v3.7.0 // indirect
3944
github.com/Microsoft/go-winio v0.6.2 // indirect
4045
github.com/RoaringBitmap/roaring v1.9.4 // indirect
46+
github.com/RoaringBitmap/roaring/v2 v2.13.0 // indirect
4147
github.com/alecthomas/chroma/v2 v2.20.0 // indirect
4248
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
4349
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b // indirect
@@ -61,6 +67,7 @@ require (
6167
github.com/dolthub/maphash v0.1.0 // indirect
6268
github.com/dunglas/httpsfv v1.1.0 // indirect
6369
github.com/dunglas/mercure v0.20.2 // indirect
70+
github.com/dunglas/skipfilter v1.0.0 // indirect
6471
github.com/dunglas/vulcain v1.2.1 // indirect
6572
github.com/dustin/go-humanize v1.0.1 // indirect
6673
github.com/felixge/httpsnoop v1.0.4 // indirect
@@ -74,8 +81,9 @@ require (
7481
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
7582
github.com/go-logr/logr v1.4.3 // indirect
7683
github.com/go-logr/stdr v1.2.2 // indirect
77-
github.com/go-openapi/jsonpointer v0.21.2 // indirect
78-
github.com/go-openapi/swag v0.23.1 // indirect
84+
github.com/go-openapi/jsonpointer v0.22.1 // indirect
85+
github.com/go-openapi/swag v0.25.1 // indirect
86+
github.com/go-openapi/swag/jsonname v0.25.1 // indirect
7987
github.com/go-sql-driver/mysql v1.9.3 // indirect
8088
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
8189
github.com/gofrs/uuid v4.4.0+incompatible // indirect
@@ -94,7 +102,7 @@ require (
94102
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
95103
github.com/gorilla/handlers v1.5.2 // indirect
96104
github.com/gorilla/mux v1.8.1 // indirect
97-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
105+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
98106
github.com/hashicorp/golang-lru v1.0.2 // indirect
99107
github.com/huandu/xstrings v1.5.0 // indirect
100108
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -108,11 +116,12 @@ require (
108116
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
109117
github.com/kylelemons/godebug v1.1.0 // indirect
110118
github.com/libdns/libdns v1.1.1 // indirect
111-
github.com/mailru/easyjson v0.9.0 // indirect
119+
github.com/mailru/easyjson v0.9.1 // indirect
112120
github.com/manifoldco/promptui v0.9.0 // indirect
113121
github.com/mattn/go-colorable v0.1.14 // indirect
114122
github.com/mattn/go-isatty v0.0.20 // indirect
115123
github.com/maypok86/otter v1.2.4 // indirect
124+
github.com/maypok86/otter/v2 v2.2.1 // indirect
116125
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
117126
github.com/mholt/acmez/v3 v3.1.4 // indirect
118127
github.com/miekg/dns v1.1.68 // indirect
@@ -135,6 +144,7 @@ require (
135144
github.com/prometheus/procfs v0.19.2 // indirect
136145
github.com/quic-go/qpack v0.5.1 // indirect
137146
github.com/quic-go/quic-go v0.55.0 // indirect
147+
github.com/rs/cors v1.11.1 // indirect
138148
github.com/rs/xid v1.6.0 // indirect
139149
github.com/russross/blackfriday/v2 v2.1.0 // indirect
140150
github.com/sagikazarmark/locafero v0.12.0 // indirect
@@ -157,7 +167,7 @@ require (
157167
github.com/subosito/gotenv v1.6.0 // indirect
158168
github.com/tailscale/tscert v0.0.0-20240608151842-d3f834017e53 // indirect
159169
github.com/tidwall/gjson v1.18.0 // indirect
160-
github.com/tidwall/match v1.1.1 // indirect
170+
github.com/tidwall/match v1.2.0 // indirect
161171
github.com/tidwall/pretty v1.2.1 // indirect
162172
github.com/tidwall/sjson v1.2.5 // indirect
163173
github.com/unrolled/secure v1.17.0 // indirect
@@ -171,18 +181,18 @@ require (
171181
go.etcd.io/bbolt v1.4.3 // indirect
172182
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
173183
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
174-
go.opentelemetry.io/contrib/propagators/autoprop v0.62.0 // indirect
175-
go.opentelemetry.io/contrib/propagators/aws v1.37.0 // indirect
176-
go.opentelemetry.io/contrib/propagators/b3 v1.37.0 // indirect
177-
go.opentelemetry.io/contrib/propagators/jaeger v1.37.0 // indirect
178-
go.opentelemetry.io/contrib/propagators/ot v1.37.0 // indirect
184+
go.opentelemetry.io/contrib/propagators/autoprop v0.63.0 // indirect
185+
go.opentelemetry.io/contrib/propagators/aws v1.38.0 // indirect
186+
go.opentelemetry.io/contrib/propagators/b3 v1.38.0 // indirect
187+
go.opentelemetry.io/contrib/propagators/jaeger v1.38.0 // indirect
188+
go.opentelemetry.io/contrib/propagators/ot v1.38.0 // indirect
179189
go.opentelemetry.io/otel v1.38.0 // indirect
180-
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.37.0 // indirect
181-
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.37.0 // indirect
190+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
191+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect
182192
go.opentelemetry.io/otel/metric v1.38.0 // indirect
183193
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
184194
go.opentelemetry.io/otel/trace v1.38.0 // indirect
185-
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
195+
go.opentelemetry.io/proto/otlp v1.8.0 // indirect
186196
go.step.sm/crypto v0.73.0 // indirect
187197
go.uber.org/automaxprocs v1.6.0 // indirect
188198
go.uber.org/multierr v1.11.0 // indirect

0 commit comments

Comments
 (0)