Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
Support enabling/disabling the agent via env var (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
kezhenxu94 committed May 28, 2020
1 parent 3129f7f commit dd51c59
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/nodejs-agent/lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function Agent() {
}

Agent.prototype.start = function(agentOptions) {
if (!!process.env.SW_ENABLED && process.env.SW_ENABLED !== "true") {
console.info("SW_ENABLED != true, the agent won't start");
return;
}
AgentConfig.initConfig(agentOptions);
serviceManager.launch();

Expand All @@ -45,7 +49,7 @@ Agent.prototype.start = function(agentOptions) {
function(originModule, moduleName, version, enhanceFile) {
let intercept = _pluginManager.attemptToFindInterceptor(moduleName, version, enhanceFile);

if (intercept == undefined) {
if (intercept === undefined) {
return originModule;
}

Expand Down

0 comments on commit dd51c59

Please sign in to comment.