This commit is contained in:
Josh Guyette 2024-02-13 08:13:42 -06:00
parent 4fd6cdab2d
commit 3cc7d1f1bf
2 changed files with 8 additions and 1 deletions

View File

@ -80,6 +80,10 @@ ngenv clear
- `-P, --proto <protocol>`: Specify the protocol (default: http). - `-P, --proto <protocol>`: Specify the protocol (default: http).
- `-p, --port <port>`: Set the port for ngrok to forward (default: 3000). - `-p, --port <port>`: Set the port for ngrok to forward (default: 3000).
- `-s, --subdomain <subdomain>`: Define a custom subdomain for the ngrok URL.
- `-r, --region <region>`: Set the region for the ngrok server (default: us).
- `-a, --auth <user:pass>`: Set basic authentication for the ngrok tunnel.
- `-t, --authtoken <token>`: Set the authtoken for ngrok (overrides the default).
- `-e, --env <path>`: Define a custom path to your `.env` file. - `-e, --env <path>`: Define a custom path to your `.env` file.
## Examples ## Examples

5
ngenv
View File

@ -6,7 +6,7 @@ const { spawn, exec } = require("child_process");
const commandLineArgs = require("command-line-args"); const commandLineArgs = require("command-line-args");
const ngrok = require("ngrok"); const ngrok = require("ngrok");
/************************************************** Global **************************************************/ /********************************************* Global Init *********************************************/
// Get the command line options // Get the command line options
const scriptName = path.basename(process.argv[1]); const scriptName = path.basename(process.argv[1]);
@ -26,6 +26,7 @@ function getOptions() {
// { name: "hostname", alias: "H", type: String }, // { name: "hostname", alias: "H", type: String },
{ name: "subdomain", alias: "s", type: String }, { name: "subdomain", alias: "s", type: String },
// { name: "config", alias: "c", type: String, multiple: true }, // { name: "config", alias: "c", type: String, multiple: true },
// { name: "name", alias: "n", type: String }, // Tunnel name, not used yet
{ name: "region", alias: "r", type: String, defaultValue: "us" }, { name: "region", alias: "r", type: String, defaultValue: "us" },
{ name: "verbose", alias: "v", type: Boolean, defaultValue: false }, { name: "verbose", alias: "v", type: Boolean, defaultValue: false },
{ name: "help", alias: "h", type: Boolean }, { name: "help", alias: "h", type: Boolean },
@ -194,6 +195,8 @@ switch (actionVerb) {
process.exit(1); process.exit(1);
} }
/******************************************* Help *******************************************/
function rootHelp() { function rootHelp() {
console.log(`Usage: ${scriptName} [run|start|stop|logs|clear] [options]`); console.log(`Usage: ${scriptName} [run|start|stop|logs|clear] [options]`);
console.log(`\nCommands:`); console.log(`\nCommands:`);