31 lines
916 B
Bash
Executable File
31 lines
916 B
Bash
Executable File
#!/bin/bash
|
|
# Script to start a local development server with environment variables
|
|
|
|
# Check if .env file exists
|
|
if [ ! -f .env ]; then
|
|
echo "Error: .env file not found!"
|
|
echo "Please create a .env file based on .env.example"
|
|
exit 1
|
|
fi
|
|
|
|
# Generate config.env.js from .env
|
|
echo "Generating config.env.js from .env..."
|
|
./generate-config.sh
|
|
|
|
# Start a local development server
|
|
echo "Starting development server..."
|
|
if command -v python3 &> /dev/null; then
|
|
echo "Using Python3 HTTP server on port 8000..."
|
|
python3 -m http.server 8000
|
|
elif command -v python &> /dev/null; then
|
|
echo "Using Python HTTP server on port 8000..."
|
|
python -m SimpleHTTPServer 8000
|
|
elif command -v npx &> /dev/null; then
|
|
echo "Using npx serve on port 8000..."
|
|
npx serve -l 8000
|
|
else
|
|
echo "Error: Could not find a suitable static file server."
|
|
echo "Please install Python or Node.js, or manually start a server."
|
|
exit 1
|
|
fi
|