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

Support passing authentication via environment variable (#99)

上级 d269b1b9
......@@ -68,7 +68,7 @@ AgentConfig.prototype.initConfig = function(agentOptions) {
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();
this._authentication = agentOptions.authentication || "";
this._authentication = process.env.SW_AUTHENTICATION || (agentOptions && agentOptions.authentication) || "";
};
......
......@@ -20,6 +20,7 @@
const args = JSON.parse(process.argv.slice(2));
let serviceName;
let directServers;
let authentication;
if (args.hasOwnProperty("sw_service_name")) {
serviceName = args["sw_service_name"];
}
......@@ -28,7 +29,12 @@ if (args.hasOwnProperty("sw_direct_Servers")) {
directServers = args["sw_direct_Servers"];
}
if (args.hasOwnProperty("sw_authentication")) {
authentication = args["sw_authentication"];
}
require("skyapm-nodejs").start({
serviceName,
directServers,
authentication,
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册