@aikidosec/firewall
Version:
Zen by Aikido is an embedded Web Application Firewall that autonomously protects Node.js apps against common and critical attacks
19 lines (18 loc) • 670 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isFeatureEnabled = isFeatureEnabled;
const isUnitTest_1 = require("./isUnitTest");
const envPrefix = "AIKIDO_FEATURE_";
/**
* Check if a feature that is behind a feature flag is enabled
* This function is case-insensitive.
* All feature flags are enabled by default in unit tests (using tap).
*/
function isFeatureEnabled(feature) {
// Always enable features in tests / ci
if ((0, isUnitTest_1.isUnitTest)()) {
return true;
}
const envVar = `${envPrefix}${feature.toUpperCase()}`;
return process.env[envVar] === "true" || process.env[envVar] === "1";
}