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

Commit

Permalink
fix(agent-options): Fix occurs exception when the serviceName is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ascrutae committed Mar 20, 2019
1 parent 1ee2a6b commit 88b4e48
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions modules/nodejs-agent/lib/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,8 @@ AgentConfig.prototype.instanceUUID = function() {
};

AgentConfig.prototype.initConfig = function(agentOptions) {
if (!agentOptions.hasOwnProperty("serviceName")) {
throw new Error("service name cannot be empty");
}
this._serviceName = agentOptions.serviceName || process.env.SW_SERVICE_NAME || "You Application";
this._directServices = agentOptions.directServers || process.env.SW_DIRECT_SERVERS || "localhost:11800";
this._serviceName = process.env.SW_SERVICE_NAME || (agentOptions && agentOptions.serviceName) || "You Application";
this._directServices = process.env.SW_DIRECT_SERVERS || (agentOptions && agentOptions.directServers) || "localhost:11800";
this._instanceUUID = agentOptions.instanceUUID || uuid();
};

Expand Down

0 comments on commit 88b4e48

Please sign in to comment.