Fix installer.
This commit is contained in:
parent
501ab48dcb
commit
59e5107f74
|
@ -14,11 +14,11 @@ $environment = App\AppFactory::buildEnvironment(
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$console = new Silly\Application('AzuraCast installer', App\Version::FALLBACK_VERSION);
|
$console = new Symfony\Component\Console\Application(
|
||||||
|
'AzuraCast installer',
|
||||||
$console->command(
|
App\Version::FALLBACK_VERSION
|
||||||
'install [--update] [--defaults] [--http-port=] [--https-port=] [--release-channel=] [base-dir]',
|
|
||||||
new App\Installer\Command\InstallCommand($environment)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$console->add(new App\Installer\Command\InstallCommand($environment));
|
||||||
|
|
||||||
$console->run();
|
$console->run();
|
||||||
|
|
|
@ -12,29 +12,49 @@ use App\Locale;
|
||||||
use App\Radio\Configuration;
|
use App\Radio\Configuration;
|
||||||
use App\Utilities\Strings;
|
use App\Utilities\Strings;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
class InstallCommand
|
#[AsCommand(
|
||||||
|
name: 'install'
|
||||||
|
)]
|
||||||
|
class InstallCommand extends Command
|
||||||
{
|
{
|
||||||
public const DEFAULT_BASE_DIRECTORY = '/installer';
|
public const DEFAULT_BASE_DIRECTORY = '/installer';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected Environment $environment
|
protected Environment $environment
|
||||||
) {
|
) {
|
||||||
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __invoke(
|
protected function configure(): void
|
||||||
SymfonyStyle $io,
|
{
|
||||||
OutputInterface $output,
|
$this->addArgument('base-dir', InputArgument::OPTIONAL)
|
||||||
bool $update,
|
->addOption('update', null, InputOption::VALUE_NONE)
|
||||||
bool $defaults,
|
->addOption('defaults', null, InputOption::VALUE_NONE)
|
||||||
?int $httpPort = null,
|
->addOption('http-port', null, InputOption::VALUE_OPTIONAL)
|
||||||
?int $httpsPort = null,
|
->addOption('https-port', null, InputOption::VALUE_OPTIONAL)
|
||||||
?string $releaseChannel = null,
|
->addOption('release-channel', null, InputOption::VALUE_OPTIONAL);
|
||||||
string $baseDir = self::DEFAULT_BASE_DIRECTORY
|
}
|
||||||
): int {
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
{
|
||||||
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
|
$baseDir = $input->getArgument('base-dir') ?? self::DEFAULT_BASE_DIRECTORY;
|
||||||
|
$update = (bool)$input->getOption('update');
|
||||||
|
$defaults = (bool)$input->getOption('defaults');
|
||||||
|
$httpPort = $input->getOption('http-port');
|
||||||
|
$httpsPort = $input->getOption('https-port');
|
||||||
|
$releaseChannel = $input->getOption('release-channel');
|
||||||
|
|
||||||
$devMode = ($baseDir !== self::DEFAULT_BASE_DIRECTORY);
|
$devMode = ($baseDir !== self::DEFAULT_BASE_DIRECTORY);
|
||||||
|
|
||||||
// Initialize all the environment variables.
|
// Initialize all the environment variables.
|
||||||
|
|
Loading…
Reference in New Issue