#!/bin/bash
# Installer and runner for S2L_Timesheet Flask app
# Usage: bash install_and_run.sh

set -e

# Create Python virtual environment
python3 -m venv venv
source venv/bin/activate


# Install dependencies
pip install --upgrade pip
pip install -r requirements.txt

# Load environment variables from .env if present
if [ -f .env ]; then
	export $(grep -v '^#' .env | xargs)
fi

# Run the Flask app on port 52000
export FLASK_APP=app.py
export FLASK_ENV=production
flask run --host=0.0.0.0 --port=52000
