Compare commits

..

No commits in common. "4fd6cdab2defb79cd4b44ee89f6e496048aa5426" and "ef155d7eecbb94ca23783e5c4c6d9192bb672e03" have entirely different histories.

2 changed files with 4 additions and 22 deletions

24
ngenv
View File

@ -17,16 +17,9 @@ const options =
: {}; : {};
function getOptions() { function getOptions() {
const optionDefinitions = [ 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: "proto", alias: "P", type: String },
{ name: "port", alias: "p", type: Number }, { name: "port", alias: "p", type: Number },
{ name: "env", alias: "e", type: String }, { 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: "verbose", alias: "v", type: Boolean, defaultValue: false },
{ name: "help", alias: "h", type: Boolean }, { name: "help", alias: "h", type: Boolean },
]; ];
@ -61,7 +54,7 @@ function findDotEnv(filename) {
} }
// Check if the ngrok config file exists // Check if the ngrok config file exists
const ngrokConfigFile = options?.config ?? getNgrokConfig(); const ngrokConfigFile = getNgrokConfig();
if (!ngrokConfigFile) { if (!ngrokConfigFile) {
console.error( console.error(
"No ngrok config file found! Run 'ngrok authtoken <token>' in your terminal." "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 // Read the ngrok config file
const authToken = options?.authtoken ?? readNgrokConfig(ngrokConfigFile); const authToken = readNgrokConfig(ngrokConfigFile);
if (!authToken) { if (!authToken) {
console.error( console.error(
"No ngrok authtoken found! Run 'ngrok authtoken <token>' in your terminal." "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.` ` -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(` -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(` -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(` -v, --verbose\t\tShow verbose output.`);
} }
console.log(` -h, --help\t\tDisplay this help message.`); console.log(` -h, --help\t\tDisplay this help message.`);
@ -233,7 +219,7 @@ function commandHelp(command) {
async function main() { async function main() {
// Get the ngrok config file path // Get the ngrok config file path
const ngrokConfig = options.config ?? getNgrokConfig(); let ngrokConfig = getNgrokConfig();
// Check if the ngrok config file exists // Check if the ngrok config file exists
if (!fs.existsSync(ngrokConfig)) { if (!fs.existsSync(ngrokConfig)) {
@ -248,10 +234,6 @@ async function main() {
authtoken: authToken, authtoken: authToken,
proto, proto,
addr, addr,
region: options?.region,
auth: options?.auth,
subdomain: options?.subdomain,
configPath: ngrokConfig,
onLogEvent: (data) => { onLogEvent: (data) => {
// console.log(data); // console.log(data);
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "ngenv", "name": "ngenv",
"version": "2.0.5", "version": "2.0.4",
"description": "Writes ngrok tunnel url to .env file", "description": "Writes ngrok tunnel url to .env file",
"main": "ngenv", "main": "ngenv",
"license": "MIT", "license": "MIT",