Add force server url override

This commit is contained in:
Sambo Chea 2022-11-30 11:50:48 +07:00
parent d54b69ce80
commit 65e3cb9797
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@cubetiq/hlt", "name": "@cubetiq/hlt",
"version": "0.1.3", "version": "0.1.4",
"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": "dist/client.js", "main": "dist/client.js",
"bin": { "bin": {

View File

@ -245,8 +245,9 @@ program
config = JSON.parse(fs.readFileSync(configFilePath, "utf8")); config = JSON.parse(fs.readFileSync(configFilePath, "utf8"));
} }
if (!config.server) { // Force reset config server from client init
config.server = options.server || SERVER_DEFAULT_URL; if (!config.server || options.force) {
config.server = options.server || config.server || SERVER_DEFAULT_URL;
} }
if (!config.token && options.token) { if (!config.token && options.token) {
@ -267,7 +268,7 @@ program
let errorCode = 0; let errorCode = 0;
if (!config.token || options.force) { if (!config.token || options.force) {
console.log("Generating token..."); console.log(`Generating token from server: ${config.server}`);
await getTokenFree(config.server, { await getTokenFree(config.server, {
timestamp: (new Date().getTime()), timestamp: (new Date().getTime()),
clientId: config.clientId, clientId: config.clientId,