From b9d6fd70b9c9c11e827c7f8e4bece1adba2453fe Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 24 Feb 2025 10:36:27 +0100 Subject: [PATCH] Displays default config after successful install. --- src/handlers/installationHandlers.js | 10 +++++----- src/handlers/nodeHandlers.js | 3 ++- src/main.js | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/handlers/installationHandlers.js b/src/handlers/installationHandlers.js index 3076783..8234144 100644 --- a/src/handlers/installationHandlers.js +++ b/src/handlers/installationHandlers.js @@ -75,9 +75,10 @@ export async function installCodex(config, showNavigationMenu) { console.log(chalk.green('Codex is already installed. Version:')); console.log(chalk.green(version)); await showNavigationMenu(); + return false; } else { console.log(chalk.cyanBright('Codex is not installed, proceeding with installation...')); - await performInstall(config, showNavigationMenu); + return await performInstall(config); } } @@ -99,12 +100,11 @@ async function clearCodexExePathFromConfig(config) { saveConfig(config); } -async function performInstall(config, showNavigationMenu) { +async function performInstall(config) { const agreed = await showPrivacyDisclaimer(); if (!agreed) { console.log(showInfoMessage('You can find manual setup instructions at docs.codex.storage')); process.exit(0); - return; } const installPath = getCodexBinPath(); @@ -202,11 +202,11 @@ async function performInstall(config, showNavigationMenu) { )); spinner.success(); - await showNavigationMenu(); + return true; } catch (error) { spinner.error(); console.log(showErrorMessage(`Failed to install Codex: ${error.message}`)); - await showNavigationMenu(); + return false; } } diff --git a/src/handlers/nodeHandlers.js b/src/handlers/nodeHandlers.js index b986794..ef0eddb 100644 --- a/src/handlers/nodeHandlers.js +++ b/src/handlers/nodeHandlers.js @@ -64,7 +64,8 @@ export async function runCodex(config, showNavigationMenu) { console.log(showInfoMessage( `Data location: ${config.dataDir}\n` + - `Logs: ${logFilePath}` + `Logs: ${logFilePath}\n` + + `API port: ${config.ports.apiPort}` )); const executable = config.codexExe; diff --git a/src/main.js b/src/main.js index 0e7b2cd..4b35b25 100644 --- a/src/main.js +++ b/src/main.js @@ -99,7 +99,10 @@ export async function main() { switch (choice.split('.')[0]) { case '1': - await installCodex(config, showNavigationMenu); + const installed = await installCodex(config, showNavigationMenu); + if (installed) { + await showConfigMenu(config); + } break; case '2': await showConfigMenu(config);