Generate new apikey if there isn't already generated one.
This commit is contained in:
@@ -76,6 +76,8 @@ echo "[$(date +"%Y-%m-%dT%H:%M:%S%z")] Running database maintenance tasks."
|
||||
echo "[$(date +"%Y-%m-%dT%H:%M:%S%z")] Ensuring state table has correct indexes."
|
||||
/opt/bin/console system:index
|
||||
|
||||
/opt/bin/console system:apikey -q
|
||||
|
||||
if [ 0 = "${WS_DISABLE_CRON}" ]; then
|
||||
if [ -f "/tmp/job-runner.pid" ]; then
|
||||
echo "[$(date +"%Y-%m-%dT%H:%M:%S%z")] Found pre-existing tasks scheduler pid file. Removing it."
|
||||
|
||||
@@ -43,18 +43,10 @@ final class APIKeyCommand extends Command
|
||||
protected function runCommand(iInput $input, iOutput $output): int
|
||||
{
|
||||
$regenerate = (bool)$input->getOption('regenerate');
|
||||
if ($regenerate) {
|
||||
if ($regenerate || null === ($apiKey = Config::get('api.key'))) {
|
||||
return $this->regenerate($output);
|
||||
}
|
||||
|
||||
if (null === ($apiKey = Config::get('api.key'))) {
|
||||
$output->writeln('<error>API key is not set.</error>');
|
||||
$output->writeln(
|
||||
'<info>Use the --regenerate option to generate a new API key to enable API & WebUI.</info>'
|
||||
);
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$output->writeln('<info>Current API key:</info>');
|
||||
$output->writeln('<comment>' . $apiKey . '</comment>');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user