Skip to content

Commit 100cbf5

Browse files
committed
Merge remote-tracking branch 'origin/feat-auto-detect-cli' into fix-installer
# Conflicts: # src/Appwrite/Platform/Tasks/Install.php
2 parents c7c59f4 + dc6b2ce commit 100cbf5

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/Appwrite/Platform/Tasks/Install.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ public function action(
212212
}
213213

214214
// If interactive and web mode enabled, start web server
215-
if ($interactive === 'Y' && Console::isInteractive()) {
215+
// Skip the web installer when explicit CLI params are provided
216+
if ($interactive === 'Y' && Console::isInteractive() && !$this->hasExplicitCliParams()) {
216217
Console::success('Starting web installer...');
217218
Console::info('Open your browser at: http://localhost:' . InstallerServer::INSTALLER_WEB_PORT);
218219
Console::info('Press Ctrl+C to cancel installation');
@@ -1283,6 +1284,22 @@ protected function applyLocalPaths(bool $isLocalInstall, bool $force = false): v
12831284
$this->hostPath = $this->getInstallerHostPath();
12841285
}
12851286

1287+
/**
1288+
* Check if any installer-specific CLI params were explicitly passed.
1289+
* When params like --database or --http-port are provided, the user
1290+
* intends to run in CLI mode rather than launching the web installer.
1291+
*/
1292+
private function hasExplicitCliParams(): bool
1293+
{
1294+
$argv = $_SERVER['argv'] ?? [];
1295+
foreach ($argv as $arg) {
1296+
if (\str_starts_with($arg, '--') && !\str_starts_with($arg, '--interactive')) {
1297+
return true;
1298+
}
1299+
}
1300+
return false;
1301+
}
1302+
12861303
/**
12871304
* Detect the database adapter from a pre-1.9.0 compose file by
12881305
* checking which DB service exists or reading _APP_DB_HOST.

0 commit comments

Comments
 (0)