Task: Allow to force start with custom api key from cli and updated version for http tunne client

This commit is contained in:
Sambo Chea 2022-06-27 23:21:33 +07:00
parent 2683bd78c0
commit cf56b920b3
2 changed files with 8 additions and 7 deletions

View File

@ -287,6 +287,10 @@ program
"keep connection for client and old connection will be closed (override connection)", "keep connection for client and old connection will be closed (override connection)",
true true
) )
.option(
"-k --key <string>",
"setting client api key for authentication access"
)
.option("-a, --access <string>", "access type (FREE)", TOKEN_FREE) .option("-a, --access <string>", "access type (FREE)", TOKEN_FREE)
.option("-p, --profile <string>", "profile name", PROFILE_DEFAULT) .option("-p, --profile <string>", "profile name", PROFILE_DEFAULT)
.option("-h, --host <string>", "local host value", "localhost") .option("-h, --host <string>", "local host value", "localhost")
@ -311,16 +315,13 @@ program
} }
if (!config.token) { if (!config.token) {
console.info(`please set token for ${config.server}`); console.info(`please init or set token for ${config.server}`);
console.info(
"if you don't have token yet, please contact to: sombochea@cubetiqs.com"
);
return; return;
} }
if (!config.clientId) { if (!config.clientId) {
if (!config.apiKey) { if (!config.apiKey) {
console.info(`please create client for ${config.server}`); console.info(`please init or create a client for ${config.server}`);
} else { } else {
config.clientId = config.apiKey; config.clientId = config.apiKey;
} }
@ -332,7 +333,7 @@ program
options.access = config.access; options.access = config.access;
options.server = config.server; options.server = config.server;
options.clientId = config.clientId; options.clientId = config.clientId;
options.apiKey = config.apiKey; options.apiKey = options.key || config.apiKey;
if (options.suffix === "port" || options.suffix === "true") { if (options.suffix === "port" || options.suffix === "true") {
options.suffix = `${port}`; options.suffix = `${port}`;

View File

@ -1,6 +1,6 @@
{ {
"name": "@cubetiq/hlt", "name": "@cubetiq/hlt",
"version": "0.0.6", "version": "0.0.7",
"description": "A lightweight http tunnel client using nodejs and socket.io client", "description": "A lightweight http tunnel client using nodejs and socket.io client",
"main": "client.js", "main": "client.js",
"bin": { "bin": {