diff --git a/scripts/install-backend.js b/scripts/install-backend.js index 78548f2b..40d3a4fc 100644 --- a/scripts/install-backend.js +++ b/scripts/install-backend.js @@ -103,6 +103,29 @@ async function main() { process.exit(1); } + // Create .env file from .env.example if it doesn't exist + const envPath = path.join(backendDir, '.env'); + const envExamplePath = path.join(backendDir, '.env.example'); + + if (fs.existsSync(envPath)) { + console.log('\nāœ“ .env file already exists'); + } else if (fs.existsSync(envExamplePath)) { + console.log('\nCreating .env file from .env.example...'); + try { + fs.copyFileSync(envExamplePath, envPath); + console.log('āœ“ Created .env file'); + console.log(' Please configure it with your credentials:'); + console.log(` - Run: claude setup-token`); + console.log(` - Or edit: ${envPath}`); + } catch (error) { + console.warn('Warning: Could not create .env file:', error.message); + console.warn('You will need to manually copy .env.example to .env'); + } + } else { + console.warn('\nWarning: .env.example not found. Cannot auto-create .env file.'); + console.warn('Please create a .env file manually if your configuration requires it.'); + } + console.log('\nBackend installation complete!'); console.log(`Virtual environment: ${venvDir}`); }