fix: update setup-couchdb.js path resolution for container environment
- Fix backendPath to work when script is in backend/scripts/ - Make .env loading conditional (exists check) - Update both backend/scripts/ and scripts/ versions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,17 @@
|
||||
|
||||
// Setup module path to include backend node_modules
|
||||
const path = require('path');
|
||||
const backendPath = path.join(__dirname, '..', 'backend');
|
||||
const backendPath = path.join(__dirname, '..');
|
||||
process.env.NODE_PATH = path.join(backendPath, 'node_modules') + ':' + (process.env.NODE_PATH || '');
|
||||
require('module').Module._initPaths();
|
||||
|
||||
const Nano = require('nano');
|
||||
require('dotenv').config({ path: path.join(backendPath, '.env') });
|
||||
// Load .env file if it exists (for local development)
|
||||
const dotenvPath = path.join(backendPath, '.env');
|
||||
const fs = require('fs');
|
||||
if (fs.existsSync(dotenvPath)) {
|
||||
require('dotenv').config({ path: dotenvPath });
|
||||
}
|
||||
|
||||
// Configuration
|
||||
const COUCHDB_URL = process.env.COUCHDB_URL || 'http://localhost:5984';
|
||||
|
||||
Reference in New Issue
Block a user