buddy-tunnel
Advanced tools
Comparing version 1.7.9-dev to 1.7.10-dev
{ | ||
"name": "buddy-tunnel", | ||
"preferGlobal": false, | ||
"version": "1.7.9-dev", | ||
"version": "1.7.10-dev", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
@@ -58,3 +58,3 @@ const AgentSystem = require('./system'); | ||
getServiceConfig(id, host, token, port, start, user) { | ||
getServiceConfig(id, host, token, port, start, user, debug) { | ||
const cli = this.getSystemBinaryPath(); | ||
@@ -66,2 +66,3 @@ return `[Unit] | ||
[Service] | ||
Environment="DEBUG=${debug ? 1 : 0}" | ||
User=${user || 'root'} | ||
@@ -77,3 +78,3 @@ WorkingDirectory=/ | ||
async enable(id, host, token, port, start, user) { | ||
async enable(id, host, token, port, start, user, debug) { | ||
try { | ||
@@ -87,3 +88,3 @@ logger.info(LOG_AGENT_SYSTEM_DIR); | ||
logger.info(LOG_AGENT_SYSTEM_SERVICE_CONFIG); | ||
await this.saveFile(this.getServicePath(), this.getServiceConfig(id, host, token, port, start, user)); | ||
await this.saveFile(this.getServicePath(), this.getServiceConfig(id, host, token, port, start, user, debug)); | ||
logger.info(LOG_AGENT_ENABLING_SYSTEM); | ||
@@ -90,0 +91,0 @@ await this.systemctl('enable --now buddy-tunnel'); |
@@ -54,3 +54,3 @@ const AgentSystem = require('./system'); | ||
getServiceConfig(id, host, token, port, start, user) { | ||
getServiceConfig(id, host, token, port, start, user, debug) { | ||
const cli = this.getSystemBinaryPath(); | ||
@@ -79,2 +79,7 @@ let cfg = `<?xml version='1.0' encoding='UTF-8'?> | ||
</array> | ||
<key>EnvironmentVariables</key> | ||
<dict> | ||
<key>DEBUG</key> | ||
<string>${debug ? 1 : 0}</string> | ||
</dict> | ||
<key>KeepAlive</key> | ||
@@ -95,3 +100,3 @@ <true/> | ||
async enable(id, host, token, port, start, user) { | ||
async enable(id, host, token, port, start, user, debug) { | ||
try { | ||
@@ -105,3 +110,3 @@ logger.info(LOG_AGENT_SYSTEM_DIR); | ||
logger.info(LOG_AGENT_SYSTEM_SERVICE_CONFIG); | ||
await this.saveFile(this.getServicePath(), this.getServiceConfig(id, host, token, port, start, user)); | ||
await this.saveFile(this.getServicePath(), this.getServiceConfig(id, host, token, port, start, user, debug)); | ||
logger.info(LOG_AGENT_ENABLING_SYSTEM); | ||
@@ -108,0 +113,0 @@ await this.launchCtl(`bootstrap system ${this.getServicePath()}`); |
@@ -102,3 +102,3 @@ const AgentSystem = require('./system'); | ||
async enable(id, host, token, port, start, user, pass) { | ||
async enable(id, host, token, port, start, user, pass, debug) { | ||
try { | ||
@@ -125,2 +125,3 @@ logger.info(LOG_AGENT_SYSTEM_DIR); | ||
await this.nssm('set buddy-tunnel Start SERVICE_AUTO_START'); | ||
await this.nssm(`set buddy-tunnel AppEnvironmentExtra DEBUG=${debug ? 1 : 0}`); | ||
if (user && pass) { | ||
@@ -127,0 +128,0 @@ await this.nssm(`nssm set buddy-tunnel ObjectName ${user} ${pass}`); |
@@ -25,3 +25,4 @@ const { Command } = require('commander'); | ||
OPTION_PASS, | ||
TXT_AGENT_ENABLED | ||
TXT_AGENT_ENABLED, | ||
OPTION_AGENT_DEBUG | ||
} = require('../../texts'); | ||
@@ -56,2 +57,3 @@ | ||
commandAgentEnable.option('--pass <password>', OPTION_PASS); | ||
commandAgentEnable.option('-d, --debug', OPTION_AGENT_DEBUG); | ||
commandAgentEnable.action(async (options) => { | ||
@@ -105,3 +107,3 @@ const hasAdminRights = await AgentManager.system.hasAdminRights(); | ||
try { | ||
await AgentManager.system.enable(id, host, token, port, !!options.start, options.user, options.pass); | ||
await AgentManager.system.enable(id, host, token, port, !!options.start, options.user, options.pass, !!options.debug); | ||
} catch { | ||
@@ -108,0 +110,0 @@ await removeAllAndExit(ERR_SWW_AGENT_ENABLING, id, host, token); |
@@ -6,3 +6,2 @@ const { Command } = require('commander'); | ||
ERR_AGENT_NOT_ENABLED, | ||
ERR_SWW, | ||
TXT_AGENT_IS_DISABLED, | ||
@@ -20,2 +19,3 @@ TXT_AGENT_IS_ENABLED_AND_HAVE_TROUBLES, | ||
const AgentManager = require('../../agent/manager'); | ||
const { ERR_AGENT_NOT_RUNNING } = require('../../texts'); | ||
@@ -30,3 +30,3 @@ const commandAgentStatus = new Command('status'); | ||
if (!commandAgentStatus.agentStatus) { | ||
Output.exitError(ERR_SWW); | ||
Output.exitError(ERR_AGENT_NOT_RUNNING); | ||
} | ||
@@ -33,0 +33,0 @@ if (commandAgentStatus.agentStatus.status === AGENT_STATUS_INITIALIZING) { |
@@ -29,2 +29,3 @@ const ERR_AGENT_NOT_REGISTERED = 'Agent not registered. Exiting...'; | ||
const ERR_AGENT_NOT_ENABLED = 'Agent is not enabled'; | ||
const ERR_AGENT_NOT_RUNNING = 'Agent is not running'; | ||
const ERR_AGENT_NOT_FOUND = 'Agent is not found'; | ||
@@ -163,2 +164,3 @@ const ERR_AGENT_DOCKER_NOT_FOUND = 'Can\'t manage agent. First install Docker and enable it for current user'; | ||
const OPTION_AGENT_PORT = 'agent api port'; | ||
const OPTION_AGENT_DEBUG = 'turns on debug mode'; | ||
@@ -261,2 +263,3 @@ const LOG_REGISTERING_AGENT = 'Registering agent...'; | ||
OPTION_AGENT_PORT, | ||
OPTION_AGENT_DEBUG, | ||
OPTION_AGENT_TOKEN, | ||
@@ -382,2 +385,3 @@ OPTION_AGENT_ID, | ||
ERR_AGENT_NOT_ENABLED, | ||
ERR_AGENT_NOT_RUNNING, | ||
ERR_SUBDOMAIN_IS_NOT_VALID, | ||
@@ -384,0 +388,0 @@ ERR_SUBDOMAIN_IS_TOO_SHORT, |
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
350427
8313