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("-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)
|
||||
.action(async (options) => {
|
||||
const configDir = path.resolve(os.homedir(), PROFILE_PATH);
|
||||
@ -224,32 +228,24 @@ program
|
||||
config = JSON.parse(fs.readFileSync(configFilePath, "utf8"));
|
||||
}
|
||||
|
||||
if (options.server) {
|
||||
config.server = options.server;
|
||||
if (!config.server) {
|
||||
config.server = options.server || SERVER_DEFAULT_URL;
|
||||
}
|
||||
|
||||
if (options.token) {
|
||||
if (!config.token && options.token) {
|
||||
config.token = options.token;
|
||||
}
|
||||
|
||||
if (options.access) {
|
||||
config.access = options.access;
|
||||
}
|
||||
|
||||
if (options.client) {
|
||||
config.clientId = options.clientId;
|
||||
}
|
||||
|
||||
if (!config.server) {
|
||||
config.server = SERVER_DEFAULT_URL;
|
||||
if (!config.access) {
|
||||
config.access = options.access || TOKEN_FREE;
|
||||
}
|
||||
|
||||
if (!config.clientId) {
|
||||
config.clientId = generateUUID();
|
||||
config.clientId = options.client || generateUUID();
|
||||
}
|
||||
|
||||
if (!config.access) {
|
||||
config.access = TOKEN_FREE;
|
||||
if (!config.apiKey && options.key) {
|
||||
config.apiKey = options.key;
|
||||
}
|
||||
|
||||
if (!config.token) {
|
||||
@ -287,8 +283,8 @@ program
|
||||
})
|
||||
.option("-s, --suffix <string>", "suffix for client name")
|
||||
.option(
|
||||
"-k, --keep_connection <boolean>",
|
||||
"keep connection for client and old connection will be closed",
|
||||
"-K, --keep_connection <boolean>",
|
||||
"keep connection for client and old connection will be closed (override connection)",
|
||||
true
|
||||
)
|
||||
.option("-a, --access <string>", "access type (FREE)", TOKEN_FREE)
|
||||
|
Loading…
Reference in New Issue
Block a user