forked from open-webui/open-webui
feat: start command for windows
This commit is contained in:
parent
4c3edd0375
commit
bd9e5c013f
1 changed files with 31 additions and 0 deletions
31
backend/start_windows.bat
Normal file
31
backend/start_windows.bat
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
@echo off
|
||||||
|
SETLOCAL ENABLEDELAYEDEXPANSION
|
||||||
|
|
||||||
|
:: Get the directory of the current script
|
||||||
|
SET "SCRIPT_DIR=%~dp0"
|
||||||
|
cd /d "%SCRIPT_DIR%" || exit /b
|
||||||
|
|
||||||
|
SET "KEY_FILE=.webui_secret_key"
|
||||||
|
SET "PORT=%PORT:8080%"
|
||||||
|
SET "WEBUI_SECRET_KEY=%WEBUI_SECRET_KEY%"
|
||||||
|
SET "WEBUI_JWT_SECRET_KEY=%WEBUI_JWT_SECRET_KEY%"
|
||||||
|
|
||||||
|
:: Check if WEBUI_SECRET_KEY and WEBUI_JWT_SECRET_KEY are not set
|
||||||
|
IF "%WEBUI_SECRET_KEY%%WEBUI_JWT_SECRET_KEY%" == " " (
|
||||||
|
echo No WEBUI_SECRET_KEY provided
|
||||||
|
|
||||||
|
IF NOT EXIST "%KEY_FILE%" (
|
||||||
|
echo Generating WEBUI_SECRET_KEY
|
||||||
|
:: Generate a random value to use as a WEBUI_SECRET_KEY in case the user didn't provide one
|
||||||
|
SET /p WEBUI_SECRET_KEY=<nul
|
||||||
|
FOR /L %%i IN (1,1,12) DO SET /p WEBUI_SECRET_KEY=<!random!>>%KEY_FILE%
|
||||||
|
echo WEBUI_SECRET_KEY generated
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Loading WEBUI_SECRET_KEY from %KEY_FILE%
|
||||||
|
SET /p WEBUI_SECRET_KEY=<%KEY_FILE%
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Execute uvicorn
|
||||||
|
SET "WEBUI_SECRET_KEY=%WEBUI_SECRET_KEY%"
|
||||||
|
uvicorn main:app --host 0.0.0.0 --port "%PORT%" --forwarded-allow-ips '*'
|
Loading…
Reference in a new issue