first update to external config values

This commit is contained in:
team 1
2026-04-24 13:13:56 +02:00
parent 868f9a8857
commit 26ec0afc5c
11 changed files with 292 additions and 187 deletions

View File

@@ -35,6 +35,11 @@ final class SystemRebuildCommand extends Command
private readonly VectorIndexHealthService $health,
private readonly TagVectorIndexHealthService $tagHealth,
private readonly string $projectDir,
private readonly string $vectorPythonBin = '.venv/bin/python',
private readonly string $vectorControlScript = 'python/vector/vector_control.py',
private readonly string $vectorHost = '0.0.0.0',
private readonly int $vectorPort = 8090,
private readonly int $vectorTimeoutSeconds = 600,
) {
parent::__construct();
}
@@ -166,17 +171,17 @@ final class SystemRebuildCommand extends Command
}
$cmd = [
'.venv/bin/python',
'python/vector/vector_control.py',
$this->vectorPythonBin,
$this->vectorControlScript,
'--install',
'--start',
'--reload',
'--port', '8090',
'--host', '0.0.0.0',
'--port', (string) $this->vectorPort,
'--host', $this->vectorHost,
];
$process = new Process($cmd, $this->projectDir);
$process->setTimeout(600);
$process->setTimeout($this->vectorTimeoutSeconds);
$process->run();
$stdout = trim($process->getOutput());

View File

@@ -17,6 +17,16 @@ use Symfony\Component\Process\Process;
)]
final class VectorControlCommand extends Command
{
public function __construct(
private readonly string $vectorPythonBin = '.venv/bin/python',
private readonly string $vectorControlScript = 'python/vector/vector_control.py',
private readonly string $defaultHost = '0.0.0.0',
private readonly int $defaultPort = 8090,
private readonly int $timeoutSeconds = 300,
) {
parent::__construct();
}
protected function configure(): void
{
$this
@@ -27,13 +37,13 @@ final class VectorControlCommand extends Command
->addOption('reload', null, InputOption::VALUE_NONE, 'Trigger /reload')
->addOption('status', null, InputOption::VALUE_NONE, 'Print status')
->addOption('foreground', null, InputOption::VALUE_NONE, 'Start in foreground (rare)')
->addOption('port', null, InputOption::VALUE_OPTIONAL, 'Port (default 8090)', '8090')
->addOption('host', null, InputOption::VALUE_OPTIONAL, 'Host (default 0.0.0.0)', '0.0.0.0');
->addOption('port', null, InputOption::VALUE_OPTIONAL, 'Port', (string) $this->defaultPort)
->addOption('host', null, InputOption::VALUE_OPTIONAL, 'Host', $this->defaultHost);
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$cmd = ['.venv/bin/python', 'python/vector/vector_control.py'];
$cmd = [$this->vectorPythonBin, $this->vectorControlScript];
if ($input->getOption('install')) {
$cmd[] = '--install';
@@ -58,17 +68,17 @@ final class VectorControlCommand extends Command
}
$cmd[] = '--port';
$cmd[] = (string)$input->getOption('port');
$cmd[] = (string) $input->getOption('port');
$cmd[] = '--host';
$cmd[] = (string)$input->getOption('host');
$cmd[] = (string) $input->getOption('host');
$process = new Process($cmd);
$process->setTimeout(300);
$process->setTimeout($this->timeoutSeconds);
$process->run();
$output->writeln($process->getOutput());
return $process->isSuccessful() ? Command::SUCCESS : Command::FAILURE;
}
}
}