未验证 提交 dd51c591 编写于 作者: K kezhenxu94 提交者: GitHub

Support enabling/disabling the agent via env var (#114)

上级 3129f7fd
...@@ -33,6 +33,10 @@ function Agent() { ...@@ -33,6 +33,10 @@ function Agent() {
} }
Agent.prototype.start = function(agentOptions) { 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); AgentConfig.initConfig(agentOptions);
serviceManager.launch(); serviceManager.launch();
...@@ -45,7 +49,7 @@ Agent.prototype.start = function(agentOptions) { ...@@ -45,7 +49,7 @@ Agent.prototype.start = function(agentOptions) {
function(originModule, moduleName, version, enhanceFile) { function(originModule, moduleName, version, enhanceFile) {
let intercept = _pluginManager.attemptToFindInterceptor(moduleName, version, enhanceFile); let intercept = _pluginManager.attemptToFindInterceptor(moduleName, version, enhanceFile);
if (intercept == undefined) { if (intercept === undefined) {
return originModule; return originModule;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册