'use strict'; function readBoolean(name, defaultValue) { const value = process.env[name]; if (value == null || value === '') return defaultValue; return !['0', 'false', 'f', 'no', 'n', 'disabled'].includes( value.toLowerCase(), ); } function readInteger(name, defaultValue) { const rawValue = process.env[name]?.trim(); if (!rawValue) return defaultValue; if (/^\d+$/.test(rawValue)) { return Number.parseInt(rawValue, 10); } process.env[name] = String(defaultValue); return defaultValue; } const hasLicenseKey = Boolean(process.env.NEW_RELIC_LICENSE_KEY); exports.config = { app_name: [process.env.NEW_RELIC_APP_NAME || 'lolympus'], license_key: process.env.NEW_RELIC_LICENSE_KEY || '', agent_enabled: readBoolean('NEW_RELIC_ENABLED', hasLicenseKey), distributed_tracing: { enabled: true, }, ai_monitoring: { enabled: readBoolean('NEW_RELIC_AI_MONITORING_ENABLED', true), }, custom_insights_events: { max_samples_stored: readInteger( 'NEW_RELIC_CUSTOM_INSIGHTS_EVENTS_MAX_SAMPLES_STORED', 100000, ), }, span_events: { max_samples_stored: readInteger( 'NEW_RELIC_SPAN_EVENTS_MAX_SAMPLES_STORED', 10000, ), }, logging: { level: process.env.NEW_RELIC_LOG_LEVEL || 'info', }, instrumentation: { timers: { enabled: false, }, }, allow_all_headers: false, attributes: { exclude: [ 'request.headers.cookie', 'request.headers.authorization', 'request.headers.proxyAuthorization', 'request.headers.setCookie*', 'response.headers.cookie', 'response.headers.authorization', 'response.headers.proxyAuthorization', 'response.headers.setCookie*', ], }, };