File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ type Option func(h *opt) error
1919// WorkerOption instances allow configuring FrankenPHP worker.
2020type WorkerOption func (* workerOpt ) error
2121
22+ // PhpServerOption instances allow to configure a PhpServer.
23+ type PhpServerOption func (* PhpServer ) error
24+
2225// opt contains the available options.
2326//
2427// If you change this, also update the Caddy module and the documentation.
Original file line number Diff line number Diff line change 66 "sync"
77)
88
9- // PhpServer represents a PHP server instance.
10- // it helps to scope a request to a specific set of configurations.
11- // useful to represent a php_server or php block in the caddyfile.
9+ // PhpServer represents a php_server block in the caddyfile.
10+ // can also be used to scope workers to a specific set of configurations.
1211type PhpServer struct {
1312 idx int
1413 root string
@@ -21,10 +20,9 @@ type PhpServer struct {
2120 mainThread * phpMainThread
2221}
2322
24- // PhpServerOption instances allow to configure a PhpServer.
25- type PhpServerOption func (* PhpServer ) error
26-
2723var (
24+ // PhpServers is a map of all registered PhpServer instances.
25+ // instances will be accessible after frankenphp.Init() has been called.
2826 PhpServers = make (map [int ]* PhpServer )
2927 phpServersMu sync.Mutex
3028)
@@ -73,6 +71,7 @@ func newDummyPhpServer() *PhpServer {
7371}
7472
7573// ServeHTTP executes a PHP script according to the given context.
74+ // the request will be scoped to the PhpServer instance.
7675func (s * PhpServer ) ServeHTTP (responseWriter http.ResponseWriter , request * http.Request , opts ... RequestOption ) error {
7776 h := responseWriter .Header ()
7877 if h ["Server" ] == nil {
You can’t perform that action at this time.
0 commit comments