File size: 1,499 Bytes
e98b0a7 | 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 | @echo off
setlocal
call "%~dp0activate_env.bat"
set "NGROK_CONFIG=%DEVTOOLS_ROOT%\ngrok_config.yml"
if "%~1"=="" (
echo ===================================================
echo PORTABLE NGROK TOOLKIT
echo ===================================================
echo.
echo Usage 1: Authenticate (Run this first time only!^)
echo ngrok_start.bat auth YOUR_AUTHTOKEN
echo.
echo Usage 2: Expose a Local Port (e.g., port 3000^)
echo ngrok_start.bat 3000
echo.
echo Usage 3: Expose a Local File Server (e.g., share a folder^)
echo ngrok_start.bat file
echo.
echo Usage 4: Advanced ngrok commands
echo ngrok_start.bat run "ngrok http 8080"
echo.
exit /b 0
)
if "%~1"=="auth" (
if "%~2"=="" (
echo [ERROR] Please provide your authtoken.
exit /b 1
)
echo [INFO] Saving token to portable config...
ngrok config add-authtoken "%~2" --config "%NGROK_CONFIG%"
echo [SUCCESS] Token saved securely in your portable folder!
exit /b 0
)
if "%~1"=="file" (
echo [INFO] Starting a public file server for the current directory...
ngrok http "file:///%CD%" --config "%NGROK_CONFIG%"
exit /b 0
)
if "%~1"=="run" (
echo [INFO] Running custom ngrok command with portable config...
%~2 --config "%NGROK_CONFIG%"
exit /b 0
)
:: Assume the argument is a port number
echo [INFO] Exposing local port %~1 to the internet...
ngrok http %~1 --config "%NGROK_CONFIG%"
endlocal
|