mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Ensured required config options cannot be left empty
This commit is contained in:
@@ -5,11 +5,14 @@ namespace Shlinkio\Shlink\Installer\Config\Plugin;
|
||||
|
||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
||||
use Shlinkio\Shlink\Installer\Model\CustomizableAppConfig;
|
||||
use Shlinkio\Shlink\Installer\Util\AskUtilsTrait;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use function str_shuffle;
|
||||
|
||||
class UrlShortenerConfigCustomizer implements ConfigCustomizerInterface
|
||||
{
|
||||
use AskUtilsTrait;
|
||||
|
||||
public function process(SymfonyStyle $io, CustomizableAppConfig $appConfig): void
|
||||
{
|
||||
$io->title('URL SHORTENER');
|
||||
@@ -25,14 +28,9 @@ class UrlShortenerConfigCustomizer implements ConfigCustomizerInterface
|
||||
['http', 'https'],
|
||||
'http'
|
||||
),
|
||||
'HOSTNAME' => $io->ask('Hostname for generated URLs'),
|
||||
'CHARS' => $io->ask(
|
||||
'Character set for generated short codes (leave empty to autogenerate one)',
|
||||
null,
|
||||
function ($value) {
|
||||
return $value;
|
||||
}
|
||||
) ?: str_shuffle(UrlShortener::DEFAULT_CHARS),
|
||||
'HOSTNAME' => $this->askRequired($io, 'hostname', 'Hostname for generated URLs'),
|
||||
'CHARS' => $io->ask('Character set for generated short codes (leave empty to autogenerate one)')
|
||||
?: str_shuffle(UrlShortener::DEFAULT_CHARS),
|
||||
'VALIDATE_URL' => $io->confirm('Do you want to validate long urls by 200 HTTP status code on response'),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user