feat: add employee management, backend health check, and UI improvements
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
export MSYS_NO_PATHCONV=1
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
@@ -33,26 +35,31 @@ set +a
|
||||
|
||||
SERVER_HOST="${SERVER_HOST:-127.0.0.1}"
|
||||
SERVER_PORT="${SERVER_PORT:-8000}"
|
||||
SERVER_RELOAD="${SERVER_RELOAD:-false}"
|
||||
|
||||
is_wsl() {
|
||||
grep -qi microsoft /proc/version 2>/dev/null
|
||||
}
|
||||
|
||||
is_windows_mount() {
|
||||
case "$SCRIPT_DIR" in
|
||||
/mnt/*) return 0 ;;
|
||||
is_msys() {
|
||||
case "$(uname -s)" in
|
||||
MINGW*|MSYS*|CYGWIN*) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
needs_windows_python() {
|
||||
is_msys || is_wsl
|
||||
}
|
||||
|
||||
find_unix_python() {
|
||||
if command -v python >/dev/null 2>&1; then
|
||||
echo "python"
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
echo "python3"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
echo "python3"
|
||||
if command -v python >/dev/null 2>&1; then
|
||||
echo "python"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -74,22 +81,6 @@ find_windows_python() {
|
||||
}
|
||||
|
||||
venv_python_path() {
|
||||
if [ "${VENV_LAYOUT:-auto}" = "windows" ]; then
|
||||
if [ -x "$VENV_DIR/Scripts/python.exe" ]; then
|
||||
echo "$VENV_DIR/Scripts/python.exe"
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "${VENV_LAYOUT:-auto}" = "unix" ]; then
|
||||
if [ -x "$VENV_DIR/bin/python" ]; then
|
||||
echo "$VENV_DIR/bin/python"
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -x "$VENV_DIR/Scripts/python.exe" ]; then
|
||||
echo "$VENV_DIR/Scripts/python.exe"
|
||||
return 0
|
||||
@@ -152,30 +143,25 @@ ensure_pip() {
|
||||
}
|
||||
|
||||
ensure_python_bootstrap() {
|
||||
if is_wsl && is_windows_mount; then
|
||||
if needs_windows_python; then
|
||||
if find_windows_python >/dev/null 2>&1; then
|
||||
PYTHON_BOOTSTRAP="$(find_windows_python)"
|
||||
VENV_LAYOUT="windows"
|
||||
info "Detected WSL on a Windows-mounted project"
|
||||
info "Using Windows Python directly from bash"
|
||||
info "Detected Windows bash environment — using Windows Python"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if find_unix_python >/dev/null 2>&1; then
|
||||
PYTHON_BOOTSTRAP="$(find_unix_python)"
|
||||
VENV_LAYOUT="unix"
|
||||
warn "Windows Python not found, falling back to WSL Python"
|
||||
warn "Windows Python not found, falling back to system Python"
|
||||
return 0
|
||||
fi
|
||||
|
||||
error "Neither Windows Python nor WSL Python is available in PATH."
|
||||
error "Python is not available in PATH."
|
||||
fi
|
||||
|
||||
if ! PYTHON_BOOTSTRAP="$(find_unix_python)"; then
|
||||
error "Python is not installed or not available in PATH. Install Python 3.11+ first so the script can create server/.venv automatically."
|
||||
fi
|
||||
|
||||
VENV_LAYOUT="unix"
|
||||
}
|
||||
|
||||
ensure_dependencies() {
|
||||
@@ -210,7 +196,11 @@ start_server() {
|
||||
info "Access: http://$SERVER_HOST:$SERVER_PORT"
|
||||
echo ""
|
||||
|
||||
exec "$PYTHON_BIN" -m uvicorn app.main:app --reload --app-dir src --host "$SERVER_HOST" --port "$SERVER_PORT"
|
||||
if [ "$SERVER_RELOAD" = "true" ]; then
|
||||
exec "$PYTHON_BIN" -m uvicorn app.main:app --reload --app-dir src --host "$SERVER_HOST" --port "$SERVER_PORT"
|
||||
fi
|
||||
|
||||
exec "$PYTHON_BIN" -m uvicorn app.main:app --app-dir src --host "$SERVER_HOST" --port "$SERVER_PORT"
|
||||
}
|
||||
|
||||
case "$MODE" in
|
||||
|
||||
Reference in New Issue
Block a user