diff options
author | Matthew Holt <[email protected]> | 2024-04-22 15:47:09 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2024-04-22 15:47:09 -0600 |
commit | 6a0299905479083f250c39d5780c305f82863273 (patch) | |
tree | 820e8d2581151abc276d3b351ba6ee2021c12fc0 /modules | |
parent | 9f97df2275638ef80ca104dd0ca51e5a7ab93b21 (diff) | |
download | caddy-6a0299905479083f250c39d5780c305f82863273.tar.gz caddy-6a0299905479083f250c39d5780c305f82863273.zip |
caddytls: Add Caddyfile support for on-demand permission module (close #6260)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/caddytls/ondemand.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/caddytls/ondemand.go b/modules/caddytls/ondemand.go index 31f6ef2dc..060a3ac6a 100644 --- a/modules/caddytls/ondemand.go +++ b/modules/caddytls/ondemand.go @@ -28,6 +28,7 @@ import ( "go.uber.org/zap" "github.com/caddyserver/caddy/v2" + "github.com/caddyserver/caddy/v2/caddyconfig/caddyfile" ) func init() { @@ -117,6 +118,17 @@ func (PermissionByHTTP) CaddyModule() caddy.ModuleInfo { } } +// UnmarshalCaddyfile implements caddyfile.Unmarshaler. +func (p *PermissionByHTTP) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { + if !d.Next() { + return nil + } + if !d.AllArgs(&p.Endpoint) { + return d.ArgErr() + } + return nil +} + func (p *PermissionByHTTP) Provision(ctx caddy.Context) error { p.logger = ctx.Logger() p.replacer = caddy.NewReplacer() |