-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartup.sh
61 lines (51 loc) · 1.21 KB
/
startup.sh
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
#!/bin/bash
# Enable strict error handling
set -euo pipefail
# Load environment variables
if [ -f .env ]; then
source .env
fi
# Validate required environment variables
if [ -z "$API_BASE_URL" ]; then
echo "ERROR: API_BASE_URL not set in .env" >&2
exit 1
fi
# Function definitions
function log_info() {
echo "$(date +"%Y-%m-%d %H:%M:%S") INFO: $*"
}
function log_error() {
echo "$(date +"%Y-%m-%d %H:%M:%S") ERROR: $*" >&2
}
function cleanup() {
log_info "Cleaning up..."
# Remove PID files (if implemented)
rm -f /tmp/fitness-tracker-mvp.pid
# Stop services (if implemented)
}
function check_dependencies() {
log_info "Checking dependencies..."
# Check if Node.js and npm are installed
if ! command -v node &> /dev/null; then
log_error "Node.js is not installed"
exit 1
fi
if ! command -v npm &> /dev/null; then
log_error "npm is not installed"
exit 1
fi
}
function start_frontend() {
log_info "Starting frontend service..."
npm run dev
}
function store_pid() {
# If PID files are implemented
# echo $! > /tmp/fitness-tracker-mvp.pid
}
# Main execution flow
trap cleanup EXIT ERR
check_dependencies
start_frontend
store_pid
log_info "Fitness Tracker MVP started successfully."