codekingpro/portable-devtools
114k
1@echo off2setlocal3call "%~dp0activate_env.bat"4 5set "NGROK_CONFIG=%DEVTOOLS_ROOT%\ngrok_config.yml"6 7if "%~1"=="" (8 echo ===================================================9 echo PORTABLE NGROK TOOLKIT10 echo ===================================================11 echo.12 echo Usage 1: Authenticate (Run this first time only!^)13 echo ngrok_start.bat auth YOUR_AUTHTOKEN14 echo.15 echo Usage 2: Expose a Local Port (e.g., port 3000^)16 echo ngrok_start.bat 300017 echo.18 echo Usage 3: Expose a Local File Server (e.g., share a folder^)19 echo ngrok_start.bat file20 echo.21 echo Usage 4: Advanced ngrok commands22 echo ngrok_start.bat run "ngrok http 8080"23 echo.24 exit /b 025)26 27if "%~1"=="auth" (28 if "%~2"=="" (29 echo [ERROR] Please provide your authtoken.30 exit /b 131 )32 echo [INFO] Saving token to portable config...33 ngrok config add-authtoken "%~2" --config "%NGROK_CONFIG%"34 echo [SUCCESS] Token saved securely in your portable folder!35 exit /b 036)37 38if "%~1"=="file" (39 echo [INFO] Starting a public file server for the current directory...40 ngrok http "file:///%CD%" --config "%NGROK_CONFIG%"41 exit /b 042)43 44if "%~1"=="run" (45 echo [INFO] Running custom ngrok command with portable config...46 %~2 --config "%NGROK_CONFIG%"47 exit /b 048)49 50:: Assume the argument is a port number51echo [INFO] Exposing local port %~1 to the internet...52ngrok http %~1 --config "%NGROK_CONFIG%"53 54endlocal55 