Skip to content

Commit 631e296

Browse files
authored
Stable Config parsing: Treat empty environment variable or process argument values as empty string (#8759)
1 parent 820d70f commit 631e296

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal-api/src/main/java/datadog/trace/bootstrap/config/provider/StableConfigParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class StableConfigParser {
2121

2222
private static final String ENVIRONMENT_VARIABLES_PREFIX = "environment_variables['";
2323
private static final String PROCESS_ARGUMENTS_PREFIX = "process_arguments['";
24-
private static final String UNDEFINED_VALUE = "UNDEFINED";
24+
private static final String UNDEFINED_VALUE = "";
2525

2626
/**
2727
* Parses a configuration file and returns a stable configuration object.

internal-api/src/test/groovy/datadog/trace/bootstrap/config/provider/StableConfigParserTest.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,13 @@ apm_configuration_rules:
190190
where:
191191
templateVar | envKey | envVal | expect
192192
"{{environment_variables['DD_KEY']}}" | "DD_KEY" | "value" | "value"
193-
"{{environment_variables['DD_KEY']}}" | null | null | "UNDEFINED"
194-
"{{}}" | null | null | "UNDEFINED"
193+
"{{environment_variables['DD_KEY']}}" | null | null | ""
194+
"{{}}" | null | null | ""
195195
"{}" | null | null | "{}"
196196
"{{environment_variables['dd_key']}}" | "DD_KEY" | "value" | "value"
197-
"{{environment_variables['DD_KEY}}" | "DD_KEY" | "value" | "UNDEFINED"
197+
"{{environment_variables['DD_KEY}}" | "DD_KEY" | "value" | ""
198198
"header-{{environment_variables['DD_KEY']}}-footer" | "DD_KEY" | "value" | "header-value-footer"
199-
"{{environment_variables['HEADER']}}{{environment_variables['DD_KEY']}}{{environment_variables['FOOTER']}}" | "DD_KEY" | "value" | "UNDEFINEDvalueUNDEFINED"
199+
"{{environment_variables['HEADER']}}{{environment_variables['DD_KEY']}}{{environment_variables['FOOTER']}}" | "DD_KEY" | "value" | "value"
200200
}
201201

202202
def "test processTemplate error cases"() {

0 commit comments

Comments
 (0)