Task: Add client and updated the initialize with not override the values if existed and updated the params for http tuunel client
This commit is contained in:
parent
06d5f0a5bd
commit
80e8f67922
34
client.js
34
client.js
@ -206,7 +206,11 @@ program
|
|||||||
""
|
""
|
||||||
)
|
)
|
||||||
.option("-a --access <string>", "setting token access type", TOKEN_FREE)
|
.option("-a --access <string>", "setting token access type", TOKEN_FREE)
|
||||||
.option("-c --client <string>", "setting client (auto generate uuid)", "")
|
.option("-c --client <string>", "setting client (auto generate uuid)")
|
||||||
|
.option(
|
||||||
|
"-k --key <string>",
|
||||||
|
"setting client api key for authentication access"
|
||||||
|
)
|
||||||
.option("-p --profile <string>", "setting profile name", PROFILE_DEFAULT)
|
.option("-p --profile <string>", "setting profile name", PROFILE_DEFAULT)
|
||||||
.action(async (options) => {
|
.action(async (options) => {
|
||||||
const configDir = path.resolve(os.homedir(), PROFILE_PATH);
|
const configDir = path.resolve(os.homedir(), PROFILE_PATH);
|
||||||
@ -224,32 +228,24 @@ program
|
|||||||
config = JSON.parse(fs.readFileSync(configFilePath, "utf8"));
|
config = JSON.parse(fs.readFileSync(configFilePath, "utf8"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.server) {
|
if (!config.server) {
|
||||||
config.server = options.server;
|
config.server = options.server || SERVER_DEFAULT_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.token) {
|
if (!config.token && options.token) {
|
||||||
config.token = options.token;
|
config.token = options.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.access) {
|
if (!config.access) {
|
||||||
config.access = options.access;
|
config.access = options.access || TOKEN_FREE;
|
||||||
}
|
|
||||||
|
|
||||||
if (options.client) {
|
|
||||||
config.clientId = options.clientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config.server) {
|
|
||||||
config.server = SERVER_DEFAULT_URL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.clientId) {
|
if (!config.clientId) {
|
||||||
config.clientId = generateUUID();
|
config.clientId = options.client || generateUUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.access) {
|
if (!config.apiKey && options.key) {
|
||||||
config.access = TOKEN_FREE;
|
config.apiKey = options.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.token) {
|
if (!config.token) {
|
||||||
@ -287,8 +283,8 @@ program
|
|||||||
})
|
})
|
||||||
.option("-s, --suffix <string>", "suffix for client name")
|
.option("-s, --suffix <string>", "suffix for client name")
|
||||||
.option(
|
.option(
|
||||||
"-k, --keep_connection <boolean>",
|
"-K, --keep_connection <boolean>",
|
||||||
"keep connection for client and old connection will be closed",
|
"keep connection for client and old connection will be closed (override connection)",
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
.option("-a, --access <string>", "access type (FREE)", TOKEN_FREE)
|
.option("-a, --access <string>", "access type (FREE)", TOKEN_FREE)
|
||||||
|
Loading…
Reference in New Issue
Block a user