Skip to content

refactor: unify php_server logic#2499

Draft
AlliBalliBaba wants to merge 18 commits into
mainfrom
refactor/phpserver
Draft

refactor: unify php_server logic#2499
AlliBalliBaba wants to merge 18 commits into
mainfrom
refactor/phpserver

Conversation

@AlliBalliBaba

Copy link
Copy Markdown
Contributor

Currently the concept of a php_server only exists on the caddy side and not the FrankenPHP side.
Lately we have been moving more and more in a direction of scoping requests or workers to specific php_server blocks.

This PR is an attempt at refactoring the current php_server logic so it is properly mirrored on the FrankenPHP side without BC breaks for library users (and to prevent future bugs like mentioned in #2487)

Comment thread options.go
type WorkerOption func(*workerOpt) error

// PhpServerOption instances allow to configure a PhpServer.
type PhpServerOption func(*PhpServer) error

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type PhpServerOption func(*PhpServer) error
type PHPServerOption func(*PhpServer) error

(Same for all symbols with "Php")

Actually, couldn't we even drop the "PHP" part entirely as it's in the FrankenPHP module anyway?

Comment thread options.go
matchRequest func(*http.Request) bool
maxConsecutiveFailures int
extensionWorkers *extensionWorkers
phpServer *PhpServer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
phpServer *PhpServer
server *Server

?

Comment thread options.go
}
}

func WithPhpServerRoot(root string, resolveSymlink bool) PhpServerOption {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we remove all the functions and only keep "withPHPServer" ?

Comment thread phpserver.go
// PhpServer represents a php_server block in the caddyfile.
// can also be used to scope workers to a specific set of configurations.
type PhpServer struct {
idx int

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants