diff --git a/scripts/datadog_wrapper b/scripts/datadog_wrapper index eb40c51bf..b1499a44c 100644 --- a/scripts/datadog_wrapper +++ b/scripts/datadog_wrapper @@ -56,6 +56,15 @@ export DD_TRACE_STATS_COMPUTATION_ENABLED="${DD_TRACE_STATS_COMPUTATION_ENABLED: debug_log "DD_TRACE_STATS_COMPUTATION_ENABLED: $DD_TRACE_STATS_COMPUTATION_ENABLED" +# When the tracer has no API key, load feature flag config through the +# extension, which adds the key it resolved (e.g. from DD_API_KEY_SECRET_ARN). +# The variables are every API key setting dd-trace-java reads, plus +# DATADOG_API_KEY, which dd-trace-js reads (Node uses this wrapper for AppSec). +if [[ "$DD_API_KEY$DATADOG_API_KEY$DD_API_KEY_FILE$DD_PROFILING_API_KEY$DD_PROFILING_API_KEY_FILE$DD_PROFILING_APIKEY$DD_PROFILING_APIKEY_FILE" =~ ^[[:space:]]*$ ]] +then + export DD_FEATURE_FLAGS_CONFIGURATION_SOURCE_AGENTLESS_BASE_URL="${DD_FEATURE_FLAGS_CONFIGURATION_SOURCE_AGENTLESS_BASE_URL:-http://127.0.0.1:8126}" +fi + # if it is .NET if [[ "$AWS_EXECUTION_ENV" == *"dotnet"* ]] then