Skip to content

Commit 6010183

Browse files
Add --admin-host argument to FrankenPHP Command (#898)
* Add CADDY_SERVER_ADMIN_HOST So that users can override the host of the Caddy admin API * Add --admin-host to frankenphp command Users can now override the admin host bind using command line arguments * Fix linting * Set admin-host option default to `localhost`, remove adminHost function * Update StartFrankenPhpCommand.php * Update StartFrankenPhpCommand.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent dda4960 commit 6010183

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Commands/StartFrankenPhpCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class StartFrankenPhpCommand extends Command implements SignalableCommandInterfa
2727
public $signature = 'octane:frankenphp
2828
{--host=127.0.0.1 : The IP address the server should bind to}
2929
{--port= : The port the server should be available on}
30+
{--admin-host=localhost : The host the admin server should be available on}
3031
{--admin-port= : The port the admin server should be available on}
3132
{--workers=auto : The number of workers that should be available to handle requests}
3233
{--max-requests=500 : The number of requests to process before reloading the server}
@@ -97,6 +98,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve
9798
'REQUEST_MAX_EXECUTION_TIME' => $this->maxExecutionTime(),
9899
'CADDY_GLOBAL_OPTIONS' => ($https && $this->option('http-redirect')) ? '' : 'auto_https disable_redirects',
99100
'CADDY_SERVER_ADMIN_PORT' => $this->adminPort(),
101+
'CADDY_SERVER_ADMIN_HOST' => $this->option('admin-host'),
100102
'CADDY_SERVER_LOG_LEVEL' => $this->option('log-level') ?: (app()->environment('local') ? 'INFO' : 'WARN'),
101103
'CADDY_SERVER_LOGGER' => 'json',
102104
'CADDY_SERVER_SERVER_NAME' => $serverName,
@@ -209,6 +211,7 @@ protected function writeServerStateFile(
209211
'appName' => config('app.name', 'Laravel'),
210212
'host' => $this->getHost(),
211213
'port' => $this->getPort(),
214+
'adminHost' => $this->option('admin-host'),
212215
'adminPort' => $this->adminPort(),
213216
'workers' => $this->workerCount(),
214217
'maxRequests' => $this->option('max-requests'),

src/Commands/stubs/Caddyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
{$CADDY_GLOBAL_OPTIONS}
33

4-
admin localhost:{$CADDY_SERVER_ADMIN_PORT}
4+
admin {$CADDY_SERVER_ADMIN_HOST}:{$CADDY_SERVER_ADMIN_PORT}
55

66
frankenphp {
77
worker "{$APP_PUBLIC_PATH}/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}

0 commit comments

Comments
 (0)