1
0
forked from baron/baron-sso
Files
baron-sso/devfront/scripts/runtime-mode.sh
2026-04-09 16:45:26 +09:00

27 lines
546 B
Bash

#!/usr/bin/env sh
set -eu
app_env="$(printf '%s' "${APP_ENV:-development}" | tr '[:upper:]' '[:lower:]')"
case "$app_env" in
production|prod|stage|staging)
mode="production"
;;
*)
mode="development"
;;
esac
if [ "${1:-}" = "--print-mode" ]; then
printf '%s\n' "$mode"
exit 0
fi
if [ "$mode" = "production" ]; then
echo "Running in production mode with Vite preview..."
exec sh -c "npm run build && npm run preview -- --host 127.0.0.1"
fi
echo "Running in development mode..."
exec npm run dev -- --host 127.0.0.1