-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-env.sh
More file actions
executable file
·66 lines (57 loc) · 1.92 KB
/
Copy pathsetup-env.sh
File metadata and controls
executable file
·66 lines (57 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# Setup script for Django-Next.js Chatbot
# This script creates .env file from .env.example
echo "🚀 Setting up environment files for Django-Next.js Chatbot..."
echo ""
# Check if .env already exists
if [ -f ".env" ]; then
echo "⚠️ .env file already exists!"
read -p "Do you want to overwrite it? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "❌ Setup cancelled. Keeping existing .env file."
exit 0
fi
fi
# Copy .env.example to .env
cp .env.example .env
echo "✅ Created .env file from .env.example"
# Prompt for OpenAI API key
echo ""
echo "📝 Please enter your API keys:"
echo ""
read -p "OpenAI API Key (required): " openai_key
if [ ! -z "$openai_key" ]; then
# Use different sed syntax for macOS vs Linux
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sed -i '' "s/OPENAI_API_KEY=your-openai-api-key-here/OPENAI_API_KEY=$openai_key/" .env
else
# Linux/WSL
sed -i "s/OPENAI_API_KEY=your-openai-api-key-here/OPENAI_API_KEY=$openai_key/" .env
fi
echo "✅ OpenAI API key added"
else
echo "⚠️ No OpenAI API key provided. You'll need to add it manually to .env"
fi
# Prompt for Tavily API key (optional)
read -p "Tavily API Key (optional, press Enter to skip): " tavily_key
if [ ! -z "$tavily_key" ]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/TAVILY_API_KEY=your-tavily-api-key-here/TAVILY_API_KEY=$tavily_key/" .env
else
sed -i "s/TAVILY_API_KEY=your-tavily-api-key-here/TAVILY_API_KEY=$tavily_key/" .env
fi
echo "✅ Tavily API key added"
else
echo "ℹ️ Tavily API key skipped (optional)"
fi
echo ""
echo "✅ Environment setup complete!"
echo ""
echo "📋 Next steps:"
echo " 1. Review .env file and adjust settings if needed"
echo " 2. Run: docker compose up --build"
echo " 3. Open http://localhost:3000 in your browser"
echo ""
echo "🎉 Happy coding!"