| @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 |
|
|