Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow debug in CADDY_GLOBAL_OPTIONS #892

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Commands/StartCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class StartCommand extends Command implements SignalableCommandInterface
{--caddyfile= : The path to the FrankenPHP Caddyfile file}
{--https : Enable HTTPS, HTTP/2, and HTTP/3, and automatically generate and renew certificates [FrankenPHP only]}
{--http-redirect : Enable HTTP to HTTPS redirection (only enabled if --https is passed) [FrankenPHP only]}
{--server-debug : Enable debug mode for the selected server [FrankenPHP only]}
{--watch : Automatically reload the server when the application is modified}
{--poll : Use file system polling while watching in order to watch files over a network}
{--log-level= : Log messages at or above the specified log level}';
Expand Down Expand Up @@ -112,6 +113,7 @@ protected function startFrankenPhpServer()
'--caddyfile' => $this->option('caddyfile'),
'--https' => $this->option('https'),
'--http-redirect' => $this->option('http-redirect'),
'--server-debug' => $this->option('server-debug'),
'--watch' => $this->option('watch'),
'--poll' => $this->option('poll'),
'--log-level' => $this->option('log-level'),
Expand Down
7 changes: 6 additions & 1 deletion src/Commands/StartFrankenPhpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class StartFrankenPhpCommand extends Command implements SignalableCommandInterfa
{--caddyfile= : The path to the FrankenPHP Caddyfile file}
{--https : Enable HTTPS, HTTP/2, and HTTP/3, and automatically generate and renew certificates}
{--http-redirect : Enable HTTP to HTTPS redirection (only enabled if --https is passed)}
{--server-debug : Enable debug mode}
{--watch : Automatically reload the server when the application is modified}
{--poll : Use file system polling while watching in order to watch files over a network}
{--log-level= : Log messages at or above the specified log level}';
Expand Down Expand Up @@ -95,7 +96,11 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve
'LARAVEL_OCTANE' => 1,
'MAX_REQUESTS' => $this->option('max-requests'),
'REQUEST_MAX_EXECUTION_TIME' => $this->maxExecutionTime(),
'CADDY_GLOBAL_OPTIONS' => ($https && $this->option('http-redirect')) ? '' : 'auto_https disable_redirects',
'CADDY_GLOBAL_OPTIONS' => trim(sprintf(
"%s\n%s",
$this->option('server-debug') ? 'debug' : '',
$https && $this->option('http-redirect') ? '' : 'auto_https disable_redirects',
)),
'CADDY_SERVER_ADMIN_PORT' => $this->adminPort(),
'CADDY_SERVER_LOG_LEVEL' => $this->option('log-level') ?: (app()->environment('local') ? 'INFO' : 'WARN'),
'CADDY_SERVER_LOGGER' => 'json',
Expand Down