Skip to content

Commit 39db699

Browse files
committed
more cleanup
1 parent fba37f6 commit 39db699

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

options.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ type Option func(h *opt) error
1919
// WorkerOption instances allow configuring FrankenPHP worker.
2020
type 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.

phpserver.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import (
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.
1211
type 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-
2723
var (
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.
7675
func (s *PhpServer) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request, opts ...RequestOption) error {
7776
h := responseWriter.Header()
7877
if h["Server"] == nil {

0 commit comments

Comments
 (0)