Merge pull request #4988 from Icinga/dkr-env

Provide the behaviour the Docker images patch into us by ourselves
This commit is contained in:
Johannes Meyer 2023-01-26 09:35:39 +01:00 committed by GitHub
commit fdcfdfa3de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -30,6 +30,8 @@ class LoggingConfigForm extends Form
*/
public function createElements(array $formData)
{
$defaultType = getenv('ICINGAWEB_OFFICIAL_DOCKER_IMAGE') ? 'php' : 'syslog';
$this->addElement(
'select',
'logging_log',
@ -38,6 +40,7 @@ class LoggingConfigForm extends Form
'autosubmit' => true,
'label' => $this->translate('Logging Type'),
'description' => $this->translate('The type of logging to utilize.'),
'value' => $defaultType,
'multiOptions' => array(
'syslog' => 'Syslog',
'php' => $this->translate('Webserver Log', 'app.config.logging.type'),
@ -94,7 +97,7 @@ class LoggingConfigForm extends Form
)
);
if (! isset($formData['logging_log']) || $formData['logging_log'] === 'syslog') {
if ((isset($formData['logging_log']) ? $formData['logging_log'] : $defaultType) === 'syslog') {
if (Platform::isWindows()) {
/* @see https://secure.php.net/manual/en/function.openlog.php */
$this->addElement(

View File

@ -11,6 +11,8 @@ $setupTokenPath = rtrim($configDir, '/') . '/setup.token';
$cliPath = realpath(Icinga::app()->getApplicationDir() . '/../bin/icingacli');
$groupadd = null;
$docker = getenv('ICINGAWEB_OFFICIAL_DOCKER_IMAGE');
if (! (false === ($distro = Platform::getLinuxDistro(1)) || $distro === 'linux')) {
foreach (array(
'groupadd -r icingaweb2' => array(
@ -79,6 +81,7 @@ if (! (false === ($distro = Platform::getLinuxDistro(1)) || $distro === 'linux')
'To run this wizard a user needs to authenticate using a token which is usually'
. ' provided to him by an administrator who\'d followed the instructions below.'
); ?></p>
<?php if (! $docker): ?>
<p><?= $this->translate('In any case, make sure that all of the following applies to your environment:'); ?></p>
<ul>
<li><?= $this->translate('A system group called "icingaweb2" exists'); ?></li>
@ -95,14 +98,19 @@ if (! (false === ($distro = Platform::getLinuxDistro(1)) || $distro === 'linux')
</div>
<?php } ?>
<p><?= $this->translate('If you\'ve got the IcingaCLI installed you can do the following:'); ?></p>
<?php endif; ?>
<div class="code">
<?php if (! $docker): ?>
<span><?= $cliPath ? $cliPath : 'icingacli'; ?> setup config directory --group icingaweb2<?= $configDir !== '/etc/icingaweb2' ? ' --config ' . $configDir : ''; ?>;</span>
<?php endif; ?>
<span><?= $cliPath ? $cliPath : 'icingacli'; ?> setup token create;</span>
</div>
<?php if (! $docker): ?>
<p><?= $this->translate('In case the IcingaCLI is missing you can create the token manually:'); ?></p>
<div class="code">
<span>su <?= $phpUser ?: $this->translate('<your-webserver-user>'); ?> -s /bin/sh -c "mkdir -m 2770 <?= dirname($setupTokenPath); ?>; chgrp icingaweb2 <?= dirname($setupTokenPath); ?>; head -c 12 /dev/urandom | base64 | tee <?= $setupTokenPath; ?>; chmod 0660 <?= $setupTokenPath; ?>;";</span>
</div>
<?php endif; ?>
<p><?= sprintf(
$this->translate('Please see the %s for an extensive description on how to access and use this wizard.'),
'<a href="http://docs.icinga.com/">' . $this->translate('Icinga Web 2 documentation') . '</a>' // TODO: Add link to iw2 docs which points to the installation topic