Fix/icingacli setup fpm flag (#5411)

resolves #5409

Only use default value for --fpm-url if neither --fpm-url or
--fpm-socket-path is set.
This commit is contained in:
Jan Schuppik 2025-08-20 09:27:31 +02:00 committed by GitHub
parent 471bdca6c2
commit 73c813eded
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 14 deletions

View File

@ -103,10 +103,12 @@ class ConfigCommand extends Command
* --enable-fpm Enable FPM handler for Apache (Nginx is always enabled) * --enable-fpm Enable FPM handler for Apache (Nginx is always enabled)
* *
* --fpm-url=<url> Address where to pass requests to FPM [127.0.0.1:9000] * --fpm-url=<url> Address where to pass requests to FPM [127.0.0.1:9000]
* Only one of --fpm-socket-path or --fpm-url can be set at a time
* *
* --fpm-uri=<uri> Alias for --fpm-url * --fpm-uri=<uri> Alias for --fpm-url
* *
* --fpm-socket-path=<socketpath> Socket path where to pass requests to FPM, overrides --fpm-url * --fpm-socket-path=<socketpath> Socket path where to pass requests to FPM
* Only one of --fpm-socket-path or --fpm-url can be set at a time
* *
* --config=<directory> Path to Icinga Web 2's configuration files [/etc/icingaweb2] * --config=<directory> Path to Icinga Web 2's configuration files [/etc/icingaweb2]
* *
@ -166,14 +168,12 @@ class ConfigCommand extends Command
$enableFpm = $this->params->shift('enable-fpm', $webserver->getEnableFpm()); $enableFpm = $this->params->shift('enable-fpm', $webserver->getEnableFpm());
$fpmSocketPath = trim($this->params->get('fpm-socket-path', $webserver->getFpmSocketPath())); $fpmSocketPath = trim($this->params->get('fpm-socket-path', $webserver->getFpmSocketPath()));
$fpmUrl = trim($this->params->get('fpm-url', $webserver->getFpmUrl())); $fpmUrl = trim($this->params->get('fpm-url'));
if (empty($fpmUrl)) { if (empty($fpmUrl)) {
$fpmUrl = trim($this->params->get('fpm-uri', $webserver->getFpmUrl())); $fpmUrl = trim($this->params->get('fpm-uri'));
} }
if (empty($fpmSocketPath) && empty($fpmUrl)) { if (empty($fpmSocketPath) && empty($fpmUrl)) {
$this->fail($this->translate( $fpmUrl = $webserver->getFpmUrl();
'One of the arguments --fpm-socket-path or --fpm-url must be set to pass requests to FPM'
));
} elseif (!empty($fpmSocketPath) && !empty($fpmUrl)) { } elseif (!empty($fpmSocketPath) && !empty($fpmUrl)) {
$this->fail($this->translate( $this->fail($this->translate(
'Only one of the arguments --fpm-socket-path or --fpm-url must be set to pass requests to FPM' 'Only one of the arguments --fpm-socket-path or --fpm-url must be set to pass requests to FPM'

View File

@ -16,14 +16,9 @@ class Apache extends Webserver
protected function createFpmUri() protected function createFpmUri()
{ {
$apacheFpmUri = ""; return empty($this->fpmSocketPath)
if (empty($this->fpmSocketPath)) { ? $this->fpmUrlSchema . $this->fpmUrl
$apacheFpmUri = $this->fpmUrlSchema . $this->fpmUrl; : $this->fpmSocketSchema . $this->fpmSocketPath . '|' . $this->fpmUrlSchema . 'localhost';
} else {
$apacheFpmUri = $this->fpmSocketSchema . $this->fpmSocketPath . '|' . $this->fpmUrlSchema . 'localhost';
}
return $apacheFpmUri;
} }
protected function getTemplate() protected function getTemplate()