@echo off
setlocal

set "ROOT_DIR=%~dp0.."
set "CONFIG_FILE=%USERPROFILE%\Saleculator.properties"
set /p "DB_HOST=Database server IP/name: "
set /p "DB_NAME=Database name [SALECULATOR]: "
if "%DB_NAME%"=="" set "DB_NAME=SALECULATOR"
set /p "DB_USER=Database user [saleculator]: "
if "%DB_USER%"=="" set "DB_USER=saleculator"
set /p "CONFIG_FILE=Config path [%USERPROFILE%\Saleculator.properties]: "
if "%CONFIG_FILE%"=="" set "CONFIG_FILE=%USERPROFILE%\Saleculator.properties"

powershell -NoProfile -ExecutionPolicy Bypass -File "%ROOT_DIR%\scripts\configure-db.ps1" -Mode network -HostName "%DB_HOST%" -Database "%DB_NAME%" -DbUser "%DB_USER%" -ConfigFile "%CONFIG_FILE%"
exit /b %ERRORLEVEL%
