Skip to content

Commit 40d5050

Browse files
committed
fix postgres url prompt
1 parent d8ab67d commit 40d5050

File tree

4 files changed

+79
-65
lines changed

4 files changed

+79
-65
lines changed

packages/cli/src/commands/start.ts

+43-26
Original file line numberDiff line numberDiff line change
@@ -285,32 +285,49 @@ const startAgents = async (options: { configure?: boolean; port?: number; charac
285285
// Prompt for database configuration
286286
logger.info('Configuring database connection...');
287287

288-
// Force reconfiguration of database by temporarily clearing the environment variable
289-
const currentPostgresUrl = process.env.POSTGRES_URL;
290-
delete process.env.POSTGRES_URL;
291-
292-
// Get existing env vars
293-
const envVars = readEnvFile();
294-
295-
// Prompt for PostgreSQL URL - simplified version
296-
const { value } = await inquirer.prompt([
297-
{
298-
type: 'input',
299-
name: 'value',
300-
message: 'Enter your PostgreSQL URL:',
301-
default: envVars.POSTGRES_URL || '', // Show the current value as default
302-
prefix: '',
303-
},
304-
]);
305-
306-
// Save the new value if provided, otherwise restore the original
307-
if (value && value.trim() !== '') {
308-
process.env.POSTGRES_URL = value.trim();
309-
envVars.POSTGRES_URL = value.trim();
310-
writeEnvFile(envVars);
311-
} else if (currentPostgresUrl) {
312-
// Restore the original value if no new one provided
313-
process.env.POSTGRES_URL = currentPostgresUrl;
288+
// If we already have a PostgreSQL URL from the configureDatabaseSettings call,
289+
// we don't need to prompt again
290+
if (!postgresUrl) {
291+
// Force reconfiguration of database by temporarily clearing the environment variable
292+
const currentPostgresUrl = process.env.POSTGRES_URL;
293+
delete process.env.POSTGRES_URL;
294+
295+
// Get existing env vars
296+
const envVars = readEnvFile();
297+
298+
// Check if we're using PGLite
299+
const usingPglite = !!process.env.PGLITE_DATA_DIR;
300+
301+
// Only prompt for PostgreSQL URL if not using PGLite
302+
if (!usingPglite) {
303+
await new Promise((resolve) => setTimeout(resolve, 100));
304+
// Prompt for PostgreSQL URL - simplified version
305+
const { value } = await inquirer.prompt([
306+
{
307+
type: 'input',
308+
name: 'value',
309+
message: 'Enter your PostgreSQL URL:',
310+
default: envVars.POSTGRES_URL || '', // Show the current value as default
311+
prefix: '',
312+
},
313+
]);
314+
315+
// Save the new value if provided, otherwise restore the original
316+
if (value && value.trim() !== '') {
317+
process.env.POSTGRES_URL = value.trim();
318+
envVars.POSTGRES_URL = value.trim();
319+
writeEnvFile(envVars);
320+
} else if (currentPostgresUrl) {
321+
// Restore the original value if no new one provided
322+
process.env.POSTGRES_URL = currentPostgresUrl;
323+
}
324+
} else {
325+
// If using PGLite, restore the current PostgreSQL URL if it exists
326+
if (currentPostgresUrl) {
327+
process.env.POSTGRES_URL = currentPostgresUrl;
328+
}
329+
logger.info('Using PGLite as database, skipping PostgreSQL URL prompt');
330+
}
314331
}
315332

316333
// Save the configuration AFTER user has made selections

packages/cli/src/index.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ import { dirname } from 'node:path';
88
import { fileURLToPath } from 'node:url';
99
import { logger } from '@elizaos/core';
1010
import { Command } from 'commander';
11-
import { agent } from './commands/agent.js';
12-
import { create } from './commands/create.js';
13-
import { dev } from './commands/dev.js';
14-
import { env } from './commands/env.js';
15-
import { plugin } from './commands/plugin.js';
16-
import { project } from './commands/project.js';
17-
import { publish } from './commands/publish.js';
18-
import { start } from './commands/start.js';
19-
import { teeCommand as tee } from './commands/tee.js';
20-
import { test } from './commands/test.js';
21-
import { update } from './commands/update.js';
22-
import { loadEnvironment } from './utils/get-config.js';
11+
import { agent } from './commands/agent';
12+
import { create } from './commands/create';
13+
import { dev } from './commands/dev';
14+
import { env } from './commands/env';
15+
import { plugin } from './commands/plugin';
16+
import { project } from './commands/project';
17+
import { publish } from './commands/publish';
18+
import { start } from './commands/start';
19+
import { teeCommand as tee } from './commands/tee';
20+
import { test } from './commands/test';
21+
import { update } from './commands/update';
22+
import { loadEnvironment } from './utils/get-config';
2323
import { displayBanner } from './displayBanner';
2424
process.on('SIGINT', () => process.exit(0));
2525
process.on('SIGTERM', () => process.exit(0));

packages/docs/static/llms-full.txt

+24-24
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ import { character as defaultCharacter } from '../characters/eliza';
231231
import { displayBanner } from '../displayBanner';
232232
import { AgentServer } from '../server/index';
233233
import { jsonToCharacter, loadCharacterTryPath } from '../server/loader';
234-
import { loadConfig, saveConfig } from '../utils/config-manager.js';
235-
import { promptForEnvVars } from '../utils/env-prompt.js';
234+
import { loadConfig, saveConfig } from '../utils/config-manager';
235+
import { promptForEnvVars } from '../utils/env-prompt';
236236
import { handleError } from '../utils/handle-error';
237237
import { installPlugin } from '../utils/install-plugin';
238238
⋮----
@@ -295,12 +295,12 @@ import { Command } from 'commander';
295295
import { existsSync } from 'node:fs';
296296
⋮----
297297
import path from 'node:path';
298-
import { loadProject } from '../project.js';
299-
import { AgentServer } from '../server/index.js';
298+
import { loadProject } from '../project';
299+
import { AgentServer } from '../server/index';
300300
import { jsonToCharacter, loadCharacterTryPath } from '../server/loader';
301-
import { TestRunner } from '../testRunner.js';
302-
import { promptForEnvVars } from '../utils/env-prompt.js';
303-
import { startAgent } from './start.js';
301+
import { TestRunner } from '../testRunner';
302+
import { promptForEnvVars } from '../utils/env-prompt';
303+
import { startAgent } from './start';
304304
async function checkPortAvailable(port: number): Promise<boolean>
305305
function checkIfLikelyPluginDir(dir: string): boolean
306306
const runAgentTests = async (options: {
@@ -322,18 +322,18 @@ import { dirname } from 'node:path';
322322
import { fileURLToPath } from 'node:url';
323323
import { logger } from '@elizaos/core';
324324
import { Command } from 'commander';
325-
import { agent } from './commands/agent.js';
326-
import { create } from './commands/create.js';
327-
import { dev } from './commands/dev.js';
328-
import { env } from './commands/env.js';
329-
import { plugin } from './commands/plugin.js';
330-
import { project } from './commands/project.js';
331-
import { publish } from './commands/publish.js';
332-
import { start } from './commands/start.js';
333-
import { teeCommand as tee } from './commands/tee.js';
334-
import { test } from './commands/test.js';
335-
import { update } from './commands/update.js';
336-
import { loadEnvironment } from './utils/get-config.js';
325+
import { agent } from './commands/agent';
326+
import { create } from './commands/create';
327+
import { dev } from './commands/dev';
328+
import { env } from './commands/env';
329+
import { plugin } from './commands/plugin';
330+
import { project } from './commands/project';
331+
import { publish } from './commands/publish';
332+
import { start } from './commands/start';
333+
import { teeCommand as tee } from './commands/tee';
334+
import { test } from './commands/test';
335+
import { update } from './commands/update';
336+
import { loadEnvironment } from './utils/get-config';
337337
import { displayBanner } from './displayBanner';
338338
⋮----
339339
async function main()
@@ -3165,7 +3165,7 @@ ElizaOS uses a unified database architecture based on Drizzle ORM with adapters
31653165

31663166
| Adapter | Best For | Key Features |
31673167
| -------------- | --------------------------- | ----------------------------------------------------------------- |
3168-
| **PGLite** | Local development & testing | Lightweight PostgreSQL implementation running in Node.js process |
3168+
| **PGLite** | Local development & testing | Lightweight PostgreSQL implementation running in Node process |
31693169
| **PostgreSQL** | Production deployments | Full PostgreSQL with vector search, scaling, and high reliability |
31703170

31713171
Additional database adapters will be supported in future releases as ElizaOS continues to evolve.
@@ -3562,7 +3562,7 @@ Yes, future releases will add support for additional databases such as:
35623562
- SQLite
35633563
- Supabase
35643564
- Qdrant
3565-
- SQL.js
3565+
- SQL
35663566

35673567
The adapter interface is designed to be extensible to support a wide range of storage solutions.
35683568

@@ -4444,7 +4444,7 @@ cd eliza
44444444

44454445
### Node Version
44464446

4447-
- Use Node.js 23.3.0+ (`node -v` to check)
4447+
- Use Node 23.3.0+ (`node -v` to check)
44484448
- Try using NVM: `nvm use 23`
44494449

44504450
### Installation Problems
@@ -4584,7 +4584,7 @@ COINGECKO_API_KEY=
45844584
"build": "turbo run build --filter=@elizaos/client && turbo run build --filter=!@elizaos/docs",
45854585
"clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo bun.lock* && turbo run clean --filter=./packages/*",
45864586
"lint": "turbo run lint --filter=./packages/* && prettier --write . && prettier --check .",
4587-
"pre-commit": "bun run scripts/pre-commit-lint.js",
4587+
"pre-commit": "bun run scripts/pre-commit-lint",
45884588
"release": "bun run build && bun lint && lerna publish --no-private --force-publish && bun lint",
45894589
"release:alpha": "lerna publish prerelease --preid alpha --dist-tag alpha --no-private --force-publish --loglevel verbose",
45904590
"migrate": "turbo run migrate --filter=./packages/plugin-sql --force",
@@ -4729,7 +4729,7 @@ COINGECKO_API_KEY=
47294729
### Prerequisites
47304730

47314731
- [Python 2.7+](https://www.python.org/downloads/)
4732-
- [Node.js 23+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
4732+
- [Node 23+](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
47334733
- [bun](https://bun.io/installation)
47344734

47354735
> **Note for Windows Users:** [WSL 2](https://learn.microsoft.com/en-us/windows/wsl/install-manual) is required.

packages/the-org/src/init.ts

-3
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ export async function initializeAllSystems(
116116
},
117117
},
118118
};
119-
console.log('*** ensuring world');
120-
console.log(world);
121119
await runtime.ensureWorldExists(world);
122-
console.log('*** ensuring world done');
123120
await initializeOnboarding(runtime, world, config);
124121
await startOnboardingDM(runtime, server, worldId);
125122
console.log('world', world);

0 commit comments

Comments
 (0)