From 80cabdd33c50eaf386293f90fd8ac57cb3a10dc9 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Mon, 23 Jan 2023 09:24:48 -0800 Subject: [PATCH] Revert "Fix: Force usage of case-sensitive keys in configurations (#6876)" (#6988) This reverts commit 8fa8408e493f3b05ba0e34852216948ef20c8154. --- .chloggen/case-sensitive-configuration.yaml | 16 ---------------- confmap/confmap.go | 8 -------- exporter/loggingexporter/config_test.go | 4 ---- .../testdata/config_loglevel_typo.yaml | 2 -- 4 files changed, 30 deletions(-) delete mode 100644 .chloggen/case-sensitive-configuration.yaml delete mode 100644 exporter/loggingexporter/testdata/config_loglevel_typo.yaml diff --git a/.chloggen/case-sensitive-configuration.yaml b/.chloggen/case-sensitive-configuration.yaml deleted file mode 100644 index efc76aa4cf0..00000000000 --- a/.chloggen/case-sensitive-configuration.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: 'bug_fix' - -# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) -component: confmap - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Fix bug in confmap validation that allowed the usage of case-insensitive keys in the configurations, despite them failing silently. - -# One or more tracking issues or pull requests related to the change -issues: [6876] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: diff --git a/confmap/confmap.go b/confmap/confmap.go index a22cb5c9c14..0bcf1dfc58c 100644 --- a/confmap/confmap.go +++ b/confmap/confmap.go @@ -161,7 +161,6 @@ func decodeConfig(m *Conf, result interface{}, errorUnused bool) error { Result: result, TagName: "mapstructure", WeaklyTypedInput: true, - MatchName: caseSensitiveMatchName, DecodeHook: mapstructure.ComposeDecodeHookFunc( expandNilStructPointersHookFunc(), mapstructure.StringToSliceHookFunc(","), @@ -190,13 +189,6 @@ func encoderConfig(rawVal interface{}) *encoder.EncoderConfig { } } -// case-sensitive version of the callback to be used in the MatchName property -// of the DecoderConfig. The default for MatchEqual is to use strings.EqualFold, -// which is case-insensitive. -func caseSensitiveMatchName(a, b string) bool { - return a == b -} - // In cases where a config has a mapping of something to a struct pointers // we want nil values to resolve to a pointer to the zero value of the // underlying struct just as we want nil values of a mapping of something diff --git a/exporter/loggingexporter/config_test.go b/exporter/loggingexporter/config_test.go index c3dc6aa18ea..ef171241529 100644 --- a/exporter/loggingexporter/config_test.go +++ b/exporter/loggingexporter/config_test.go @@ -74,10 +74,6 @@ func TestUnmarshalConfig(t *testing.T) { filename: "invalid_verbosity_loglevel.yaml", expectedErr: "'loglevel' and 'verbosity' are incompatible. Use only 'verbosity' instead", }, - { - filename: "config_loglevel_typo.yaml", - expectedErr: "1 error(s) decoding:\n\n* '' has invalid keys: logLevel", - }, } for _, tt := range tests { diff --git a/exporter/loggingexporter/testdata/config_loglevel_typo.yaml b/exporter/loggingexporter/testdata/config_loglevel_typo.yaml deleted file mode 100644 index 59222127eb7..00000000000 --- a/exporter/loggingexporter/testdata/config_loglevel_typo.yaml +++ /dev/null @@ -1,2 +0,0 @@ -# Typo in the configuration that assumes that this property is camelcase -logLevel: debug