@azure/opentelemetry-instrumentation-azure-sdk
Version:
Instrumentation client for the Azure SDK.
29 lines • 894 B
JavaScript
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
export const SDK_VERSION = "1.0.0";
/**
* @internal
*
* Cached values of environment variables that were fetched.
*/
export const environmentCache = new Map();
/**
* Converts an environment variable to Boolean.
* the strings "false" and "0" are treated as falsy values.
*
* @internal
*/
export function envVarToBoolean(key) {
if (!environmentCache.has(key)) {
loadEnvironmentVariable(key);
}
const value = (environmentCache.get(key) ?? "").toLowerCase();
return value !== "false" && value !== "0" && Boolean(value);
}
function loadEnvironmentVariable(key) {
if (typeof process !== "undefined" && process.env) {
const rawValue = process.env[key] ?? process.env[key.toLowerCase()];
environmentCache.set(key, rawValue);
}
}
//# sourceMappingURL=configuration.js.map