Compare commits
No commits in common. "4fd6cdab2defb79cd4b44ee89f6e496048aa5426" and "ef155d7eecbb94ca23783e5c4c6d9192bb672e03" have entirely different histories.
4fd6cdab2d
...
ef155d7eec
24
ngenv
24
ngenv
|
@ -17,16 +17,9 @@ const options =
|
|||
: {};
|
||||
function getOptions() {
|
||||
const optionDefinitions = [
|
||||
{ name: "config", alias: "C", type: String },
|
||||
{ name: "auth", alias: "a", type: String },
|
||||
{ name: "authtoken", alias: "t", type: String },
|
||||
{ name: "proto", alias: "P", type: String },
|
||||
{ name: "port", alias: "p", type: Number },
|
||||
{ name: "env", alias: "e", type: String },
|
||||
// { name: "hostname", alias: "H", type: String },
|
||||
{ name: "subdomain", alias: "s", type: String },
|
||||
// { name: "config", alias: "c", type: String, multiple: true },
|
||||
{ name: "region", alias: "r", type: String, defaultValue: "us" },
|
||||
{ name: "verbose", alias: "v", type: Boolean, defaultValue: false },
|
||||
{ name: "help", alias: "h", type: Boolean },
|
||||
];
|
||||
|
@ -61,7 +54,7 @@ function findDotEnv(filename) {
|
|||
}
|
||||
|
||||
// Check if the ngrok config file exists
|
||||
const ngrokConfigFile = options?.config ?? getNgrokConfig();
|
||||
const ngrokConfigFile = getNgrokConfig();
|
||||
if (!ngrokConfigFile) {
|
||||
console.error(
|
||||
"No ngrok config file found! Run 'ngrok authtoken <token>' in your terminal."
|
||||
|
@ -89,7 +82,7 @@ function getNgrokConfig(pathOnly = false) {
|
|||
}
|
||||
|
||||
// Read the ngrok config file
|
||||
const authToken = options?.authtoken ?? readNgrokConfig(ngrokConfigFile);
|
||||
const authToken = readNgrokConfig(ngrokConfigFile);
|
||||
if (!authToken) {
|
||||
console.error(
|
||||
"No ngrok authtoken found! Run 'ngrok authtoken <token>' in your terminal."
|
||||
|
@ -216,14 +209,7 @@ function commandHelp(command) {
|
|||
` -P, --proto\t\tProtocol to use (http|tcp|tls). Default is http.`
|
||||
);
|
||||
console.log(` -p, --port\t\tPort to use. Default is 3000.`);
|
||||
console.log(` -s, --subdomain\tSubdomain to use; [xyz].ngrok.io`);
|
||||
console.log(` -r, --region\t\tRegion to use. Default is 'us'.`);
|
||||
console.log(` -a, --auth\t\tHTTP Basic authentication for tunnel.`);
|
||||
console.log(
|
||||
` -t, --authtoken\tYour authtoken from ngrok.com. Uses config file if not provided.`
|
||||
);
|
||||
console.log(` -e, --env\t\tEnvironment file to use. Default is .env.`);
|
||||
console.log(` -C, --config\t\tCustom path to ngrok config file.`);
|
||||
console.log(` -v, --verbose\t\tShow verbose output.`);
|
||||
}
|
||||
console.log(` -h, --help\t\tDisplay this help message.`);
|
||||
|
@ -233,7 +219,7 @@ function commandHelp(command) {
|
|||
|
||||
async function main() {
|
||||
// Get the ngrok config file path
|
||||
const ngrokConfig = options.config ?? getNgrokConfig();
|
||||
let ngrokConfig = getNgrokConfig();
|
||||
|
||||
// Check if the ngrok config file exists
|
||||
if (!fs.existsSync(ngrokConfig)) {
|
||||
|
@ -248,10 +234,6 @@ async function main() {
|
|||
authtoken: authToken,
|
||||
proto,
|
||||
addr,
|
||||
region: options?.region,
|
||||
auth: options?.auth,
|
||||
subdomain: options?.subdomain,
|
||||
configPath: ngrokConfig,
|
||||
onLogEvent: (data) => {
|
||||
// console.log(data);
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ngenv",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.4",
|
||||
"description": "Writes ngrok tunnel url to .env file",
|
||||
"main": "ngenv",
|
||||
"license": "MIT",
|
||||
|
|
Loading…
Reference in New Issue