genbox 1.0.52 → 1.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -321,10 +321,19 @@ class ProfileResolver {
321
321
  * Resolve database mode
322
322
  */
323
323
  async resolveDatabaseMode(config, options, profile) {
324
- // Helper to get MongoDB URL for an environment
324
+ // Load env vars from .env.genbox (where init stores MongoDB URLs)
325
+ const envVars = this.configLoader.loadEnvVars(process.cwd());
326
+ // Helper to get MongoDB URL from .env.genbox
327
+ // Matches what init saves: PROD_MONGODB_URL, STAGING_MONGODB_URL
325
328
  const getMongoUrl = (source) => {
326
- const envConfig = config.environments?.[source];
327
- return envConfig?.urls?.mongodb;
329
+ if (source === 'production') {
330
+ return envVars['PROD_MONGODB_URL'] || envVars['PRODUCTION_MONGODB_URL'];
331
+ }
332
+ else if (source === 'staging') {
333
+ return envVars['STAGING_MONGODB_URL'];
334
+ }
335
+ // Custom environments: {NAME}_MONGODB_URL
336
+ return envVars[`${source.toUpperCase()}_MONGODB_URL`];
328
337
  };
329
338
  // CLI flag takes precedence
330
339
  if (options.db) {
@@ -374,6 +383,18 @@ class ProfileResolver {
374
383
  */
375
384
  async selectDatabaseModeInteractive(config) {
376
385
  console.log(chalk_1.default.cyan('\nšŸ—„ļø Database Configuration:\n'));
386
+ // Load env vars from .env.genbox (where init stores MongoDB URLs)
387
+ const envVars = this.configLoader.loadEnvVars(process.cwd());
388
+ // Helper to get MongoDB URL from .env.genbox
389
+ const getMongoUrl = (source) => {
390
+ if (source === 'production') {
391
+ return envVars['PROD_MONGODB_URL'] || envVars['PRODUCTION_MONGODB_URL'];
392
+ }
393
+ else if (source === 'staging') {
394
+ return envVars['STAGING_MONGODB_URL'];
395
+ }
396
+ return envVars[`${source.toUpperCase()}_MONGODB_URL`];
397
+ };
377
398
  const modeChoices = [
378
399
  { name: 'None (no database)', value: 'none' },
379
400
  { name: 'Fresh (empty database)', value: 'local' },
@@ -405,18 +426,14 @@ class ProfileResolver {
405
426
  }
406
427
  else if (answer.startsWith('copy-')) {
407
428
  const source = answer.replace('copy-', '');
408
- const envConfig = config.environments?.[source];
409
- const mongoUrl = envConfig?.urls?.mongodb;
410
- return { mode: 'copy', source, url: mongoUrl };
429
+ return { mode: 'copy', source, url: getMongoUrl(source) };
411
430
  }
412
431
  else if (answer.startsWith('remote-')) {
413
432
  const source = answer.replace('remote-', '');
414
- const envConfig = config.environments?.[source];
415
- const mongoUrl = envConfig?.urls?.mongodb;
416
433
  return {
417
434
  mode: 'remote',
418
435
  source,
419
- url: mongoUrl,
436
+ url: getMongoUrl(source),
420
437
  };
421
438
  }
422
439
  return { mode: 'local' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genbox",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "Genbox CLI - AI-Powered Development Environments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {