From bd9e5c013f44ec958938c153b7217330670aeeb8 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 17 Feb 2024 10:41:17 -0800 Subject: [PATCH 1/3] feat: start command for windows --- backend/start_windows.bat | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 backend/start_windows.bat diff --git a/backend/start_windows.bat b/backend/start_windows.bat new file mode 100644 index 00000000..9d10ef9f --- /dev/null +++ b/backend/start_windows.bat @@ -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=>%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 '*' From 22d2c1371375a4df302bc9f87fd9a6479b4c0e69 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 17 Feb 2024 10:43:50 -0800 Subject: [PATCH 2/3] Update start_windows.bat --- backend/start_windows.bat | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/start_windows.bat b/backend/start_windows.bat index 9d10ef9f..45634ef8 100644 --- a/backend/start_windows.bat +++ b/backend/start_windows.bat @@ -1,3 +1,5 @@ +REM This method is not recommended, and we recommend you use the `start.sh` file with WSL instead. + @echo off SETLOCAL ENABLEDELAYEDEXPANSION From d1e5274fc91ac51d60fb3250e76bf21cfe711f9b Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 17 Feb 2024 11:25:11 -0800 Subject: [PATCH 3/3] Update start_windows.bat --- backend/start_windows.bat | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/start_windows.bat b/backend/start_windows.bat index 45634ef8..b2c37017 100644 --- a/backend/start_windows.bat +++ b/backend/start_windows.bat @@ -1,5 +1,4 @@ -REM This method is not recommended, and we recommend you use the `start.sh` file with WSL instead. - +:: This method is not recommended, and we recommend you use the `start.sh` file with WSL instead. @echo off SETLOCAL ENABLEDELAYEDEXPANSION