-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-env.sh
More file actions
executable file
Β·47 lines (40 loc) Β· 1.56 KB
/
setup-env.sh
File metadata and controls
executable file
Β·47 lines (40 loc) Β· 1.56 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
#!/bin/bash
# Setup script for centralizing environment variables
# This script creates .env.production from the template and validates the configuration
set -e
echo "π Setting up centralized environment configuration..."
# Check if .env.production already exists
if [ -f ".env.production" ]; then
echo "β οΈ .env.production already exists!"
read -p "Do you want to overwrite it? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "β Setup cancelled."
exit 1
fi
fi
# Create .env.production from template
if [ -f "env.production.template" ]; then
echo "π Creating .env.production from template..."
cp env.production.template .env.production
echo "β
.env.production created successfully!"
else
echo "β Template file 'env.production.template' not found!"
exit 1
fi
# Make the file readable only by owner for security
chmod 600 .env.production
echo "π§ Environment configuration setup complete!"
echo ""
echo "π Next steps:"
echo "1. Review and modify .env.production if needed"
echo "2. Run 'docker-compose up --build' to test the configuration"
echo "3. The environment variables are now centralized in .env.production"
echo ""
echo "π Configuration summary:"
echo "- Environment variables are defined in: .env.production"
echo "- Docker Compose reads from: .env.production (via env_file)"
echo "- Docker build gets variables as build args from docker-compose.yml"
echo "- Next.js config has fallback values in next.config.js"
echo ""
echo "β¨ No more duplicate configuration across multiple files!"