buddy-tunnel
Advanced tools
Comparing version 1.7.27-dev to 1.7.28-dev
{ | ||
"name": "buddy-tunnel", | ||
"preferGlobal": false, | ||
"version": "1.7.27-dev", | ||
"version": "1.7.28-dev", | ||
"type": "commonjs", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -28,4 +28,3 @@ const { | ||
TUNNEL_SSH, | ||
createSshHostKey, | ||
isDocker | ||
createSshHostKey | ||
} = require('../utils'); | ||
@@ -39,3 +38,2 @@ const AgentOsx = require('./osx'); | ||
const AgentWindows = require('./windows'); | ||
const AgentDocker = require('./docker'); | ||
@@ -54,5 +52,3 @@ class AgentManagerClass { | ||
this.ws = null; | ||
if (isDocker()) { | ||
this.system = new AgentDocker(); | ||
} else if (isOsx()) { | ||
if (isOsx()) { | ||
this.system = new AgentOsx(); | ||
@@ -59,0 +55,0 @@ } else if (isLinux()) { |
@@ -28,3 +28,2 @@ const { Command } = require('commander'); | ||
} = require('../../texts'); | ||
const { isDocker } = require('../../utils'); | ||
@@ -60,3 +59,2 @@ const removeAllAndExit = async (txt, id, host, token) => { | ||
commandAgentEnable.action(async (options) => { | ||
const isd = isDocker(); | ||
const hasAdminRights = await AgentManager.system.hasAdminRights(); | ||
@@ -71,3 +69,3 @@ if (!hasAdminRights) { | ||
const isEnabled = await AgentManager.system.isEnabled(); | ||
if (isEnabled && !isd) { | ||
if (isEnabled) { | ||
Output.exitSuccess(TXT_AGENT_ALREADY_ENABLED); | ||
@@ -93,14 +91,2 @@ } | ||
let host = Cfg.getTokenHost(); | ||
if (isEnabled && isd) { | ||
try { | ||
const agentConfig = await AgentManager.system.loadSystemConfig(); | ||
id = agentConfig.id; | ||
token = agentConfig.token; | ||
port = agentConfig.port; | ||
host = agentConfig.host; | ||
agent = await ApiBuddy.fetchAgent(id, host, token); | ||
} catch { | ||
Output.exitError(ERR_AGENT_NOT_FOUND); | ||
} | ||
} | ||
if (!agent) { | ||
@@ -117,4 +103,4 @@ agent = await ApiBuddy.register(true, host, Cfg.getToken(), (region) => { | ||
} | ||
if (!isd) await Output.spinner(TXT_ENABLING_AGENT); | ||
if (process.env.DEBUG === '1' || isd) { | ||
await Output.spinner(TXT_ENABLING_AGENT); | ||
if (process.env.DEBUG === '1') { | ||
AgentManager.start(id, host, token, port, !!options.start); | ||
@@ -121,0 +107,0 @@ return; |
@@ -13,7 +13,9 @@ const { | ||
try { | ||
const isEnabled = await AgentManager.system.isEnabled(); | ||
if (isEnabled) { | ||
const json = AgentManager.system.loadSystemConfig(); | ||
const api = new ApiAgent(json.port); | ||
command.agentStatus = await api.fetchStatus(); | ||
if (!isDocker()) { | ||
const isEnabled = await AgentManager.system.isEnabled(); | ||
if (isEnabled) { | ||
const json = AgentManager.system.loadSystemConfig(); | ||
const api = new ApiAgent(json.port); | ||
command.agentStatus = await api.fetchStatus(); | ||
} | ||
} | ||
@@ -37,3 +39,3 @@ } catch { | ||
Output.newCliDockerVersion(command.latestVersion); | ||
}else if (newCli && newAgent) { | ||
} else if (newCli && newAgent) { | ||
Output.newCliAgentVersion(command.latestVersion); | ||
@@ -40,0 +42,0 @@ } else if (newCli) { |
@@ -13,2 +13,3 @@ const { Command } = require('commander'); | ||
const stream = require('stream'); | ||
const { isDocker } = require('./utils'); | ||
@@ -29,5 +30,5 @@ stream.setDefaultHighWaterMark(false, 67108864); | ||
program.addCommand(commandStart); | ||
program.addCommand(commandAgent); | ||
if (!isDocker()) program.addCommand(commandAgent); | ||
program.addCommand(commandVersion); | ||
program.parse(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16
352568
95
8387