-
Notifications
You must be signed in to change notification settings - Fork 461
Expand file tree
/
Copy pathcaddy.go
More file actions
35 lines (27 loc) · 1.16 KB
/
Copy pathcaddy.go
File metadata and controls
35 lines (27 loc) · 1.16 KB
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
// Package caddy provides a PHP module for the Caddy web server.
// FrankenPHP embeds the PHP interpreter directly in Caddy, giving it the ability to run your PHP scripts directly.
// No PHP FPM required!
package caddy
import (
"fmt"
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
)
const (
defaultDocumentRoot = "public"
defaultWatchPattern = "./**/*.{env,php,twig,yaml,yml}"
)
func init() {
caddy.RegisterModule(FrankenPHPApp{})
caddy.RegisterModule(FrankenPHPModule{})
caddy.RegisterModule(FrankenPHPAdmin{})
httpcaddyfile.RegisterGlobalOption("frankenphp", parseGlobalOption)
httpcaddyfile.RegisterHandlerDirective("php", parseCaddyfile)
httpcaddyfile.RegisterDirectiveOrder("php", "before", "file_server")
httpcaddyfile.RegisterDirective("php_server", parsePhpServer)
httpcaddyfile.RegisterDirectiveOrder("php_server", "before", "file_server")
}
// wrongSubDirectiveError returns a nice error message.
func wrongSubDirectiveError(module string, allowedDirectives string, wrongValue string) error {
return fmt.Errorf("unknown %q subdirective: %s (allowed directives are: %s)", module, wrongValue, allowedDirectives)
}