Files
yovision/Sense/scripts/runtime/start-sense.bat
T

46 lines
1.4 KiB
Batchfile

@echo off
setlocal
cd /d "%~dp0"
set "SENSE_UI_STATIC_DIR=%~dp0ui"
if /I "%~1"=="demo" goto :demo
set "SENSE_DATABASE_MODE=postgres"
if "%SENSE_DATABASE_URL%"=="" goto :missing_database_url
if "%SENSE_IDENTITY_SIGNING_KEY%"=="" goto :missing_identity_key
if "%SENSE_BOOTSTRAP_TOKEN%"=="" goto :missing_bootstrap_token
if "%SENSE_CREDENTIAL_KEY%"=="" goto :missing_credential_key
echo Starting Sense in production mode at %SENSE_HTTP_ADDRESS%...
"%~dp0sense-server.exe"
exit /b %ERRORLEVEL%
:demo
set "SENSE_DATABASE_MODE=memory"
if "%SENSE_HTTP_ADDRESS%"=="" set "SENSE_HTTP_ADDRESS=127.0.0.1:18080"
echo Starting Sense in temporary demo mode at http://%SENSE_HTTP_ADDRESS% ...
echo Demo data is discarded when the process stops. Do not use this mode in production.
"%~dp0sense-server.exe"
exit /b %ERRORLEVEL%
:missing_database_url
echo [ERROR] SENSE_DATABASE_URL is required in production mode.
goto :configuration_help
:missing_identity_key
echo [ERROR] SENSE_IDENTITY_SIGNING_KEY is required in production mode.
goto :configuration_help
:missing_bootstrap_token
echo [ERROR] SENSE_BOOTSTRAP_TOKEN is required in production mode.
goto :configuration_help
:missing_credential_key
echo [ERROR] SENSE_CREDENTIAL_KEY is required in production mode.
:configuration_help
echo Set the required environment variables outside this directory.
echo See README-WINDOWS.md and config\sense.env.example.
exit /b 1