forked from ericc-ch/copilot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-https.bat
More file actions
64 lines (56 loc) · 1.74 KB
/
Copy pathstart-https.bat
File metadata and controls
64 lines (56 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@echo off
:: Make the script location-independent: run everything relative to this file's
:: folder so .env, certs\, and `bun run ./src/main.ts` always resolve the same
:: way whether double-clicked or called by full path.
cd /d "%~dp0"
setlocal
TITLE Copilot API Proxy (HTTPS 8443)
echo ================================================
echo GitHub Copilot API Proxy - HTTPS
echo Port: 8443
echo ================================================
echo.
:: Load environment variables from .env if it exists
if exist .env (
echo Loading environment from .env...
for /f "usebackq tokens=1,* delims==" %%A in (".env") do (
if not "%%A"=="" if not "%%A:~0,1%"=="#" (
set "%%A=%%B"
)
)
echo.
)
:: --- Port + TLS / HTTPS configuration ---------------------------------
set "PORT=8443"
:: LAN IP the other laptop uses to reach this PC (must match a cert SAN).
set "LAN_IP=192.168.0.105"
:: Point the server at the self-signed cert generated by generate-cert.bat.
set "TLS_CERT=%~dp0certs\server.crt"
set "TLS_KEY=%~dp0certs\server.key"
if not exist "%TLS_CERT%" (
echo TLS certificate not found at "%TLS_CERT%".
echo Run generate-cert.bat first to create it.
echo.
pause
exit /b 1
)
:: Build if dist/ doesn't exist
if not exist dist (
echo Building project...
bun run build
echo.
)
if defined TAVILY_API_KEY (
echo Web search: enabled ^(Tavily^)
) else if defined BRAVE_API_KEY (
echo Web search: enabled ^(Brave^)
) else (
echo Web search: disabled ^(set TAVILY_API_KEY or BRAVE_API_KEY in .env to enable^)
)
echo.
echo Starting server on https://localhost:%PORT%
echo Reachable from other machines at https://%LAN_IP%:%PORT%
echo.
bun run ./src/main.ts start --port %PORT%
pause
endlocal