-
Notifications
You must be signed in to change notification settings - Fork 0
/
caddyfile.go
41 lines (39 loc) · 1.2 KB
/
caddyfile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package dotnet
import (
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
)
// parseCaddyfile sets up the handler from Caddyfile tokens.
func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) {
var d DotNet
for h.Next() {
for h.NextBlock(0) {
switch h.Val() {
case "exec_path":
if !h.NextArg() {
return nil, h.ArgErr()
}
d.ExecPath = h.Val()
case "args":
d.Args = h.RemainingArgs()
case "env_vars":
d.EnvVars = h.RemainingArgs()
case "working_dir":
if !h.NextArg() {
return nil, h.ArgErr()
}
d.WorkingDir = h.Val()
case "socket":
if !h.NextArg() {
return nil, h.ArgErr()
}
d.Socket = h.Val()
case "syslog_output":
d.SyslogOutput = true
default:
return nil, h.Errf("unknown property: %s", h.Val())
}
}
}
return &d, nil
}