@echo off
setlocal

set "ROOT_DIR=%~dp0.."
set "CONFIG_FILE=%~1"
if "%CONFIG_FILE%"=="" set "CONFIG_FILE=%USERPROFILE%\Saleculator.properties"
set "REMOTE_FLAG="
set /p "ALLOW_REMOTE=Will other POS machines connect to this database? [y/N]: "
if /i "%ALLOW_REMOTE%"=="Y" set "REMOTE_FLAG=-AllowRemoteClients"

powershell -NoProfile -ExecutionPolicy Bypass -File "%ROOT_DIR%\scripts\configure-db.ps1" -Mode local -ConfigFile "%CONFIG_FILE%" %REMOTE_FLAG%
exit /b %ERRORLEVEL%
