mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-01 20:53:14 +08:00
45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Shlinkio\Shlink\CLI\Install\Plugin;
|
|
|
|
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
|
|
use Shlinkio\Shlink\Common\Util\StringUtilsTrait;
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
|
|
class ApplicationConfigCustomizer implements ConfigCustomizerInterface
|
|
{
|
|
use StringUtilsTrait;
|
|
|
|
/**
|
|
* @param SymfonyStyle $io
|
|
* @param CustomizableAppConfig $appConfig
|
|
* @return void
|
|
*/
|
|
public function process(SymfonyStyle $io, CustomizableAppConfig $appConfig)
|
|
{
|
|
$io->title('APPLICATION');
|
|
|
|
if ($appConfig->hasApp() && $io->confirm('Do you want to keep imported application config?')) {
|
|
return;
|
|
}
|
|
|
|
$validator = function ($value) {
|
|
return $value;
|
|
};
|
|
$appConfig->setApp([
|
|
'SECRET' => $io->ask(
|
|
'Define a secret string that will be used to sign API tokens (leave empty to autogenerate one)',
|
|
null,
|
|
$validator
|
|
) ?: $this->generateRandomString(32),
|
|
'DISABLE_TRACK_PARAM' => $io->ask(
|
|
'Provide a parameter name that you will be able to use to disable tracking on specific request to '
|
|
. 'short URLs (leave empty and this feature won\'t be enabled)',
|
|
null,
|
|
$validator
|
|
),
|
|
]);
|
|
}
|
|
}
|