Skip to content

Commit

Permalink
Mark confmap.expandEnabled as stable (#7323)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
  • Loading branch information
bogdandrutu committed Mar 6, 2023
1 parent 1374845 commit 9668658
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
11 changes: 11 additions & 0 deletions .chloggen/stableexpandEnabled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# 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: Mark `confmap.expandEnabled` as stable

# One or more tracking issues or pull requests related to the change
issues: [7323]
22 changes: 10 additions & 12 deletions confmap/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ var (
errTooManyRecursiveExpansions = errors.New("too many recursive expansions")
)

// TODO: Remove this if by v0.64.0 no complains from distros.
var expandEnabledGauge = featuregate.GlobalRegistry().MustRegister(
var _ = featuregate.GlobalRegistry().MustRegister(
"confmap.expandEnabled",
featuregate.StageBeta,
featuregate.StageStable,
featuregate.WithRegisterRemovalVersion("v0.75.0"),
featuregate.WithRegisterDescription("controls whether expanding embedded external config providers URIs"))

// Resolver resolves a configuration as a Conf.
Expand Down Expand Up @@ -165,17 +165,15 @@ func (mr *Resolver) Resolve(ctx context.Context) (*Conf, error) {
}
}

if expandEnabledGauge.IsEnabled() {
cfgMap := make(map[string]any)
for _, k := range retMap.AllKeys() {
val, err := mr.expandValueRecursively(ctx, retMap.Get(k))
if err != nil {
return nil, err
}
cfgMap[k] = val
cfgMap := make(map[string]any)
for _, k := range retMap.AllKeys() {
val, err := mr.expandValueRecursively(ctx, retMap.Get(k))
if err != nil {
return nil, err
}
retMap = NewFromStringMap(cfgMap)
cfgMap[k] = val
}
retMap = NewFromStringMap(cfgMap)

// Apply the converters in the given order.
for _, confConv := range mr.converters {
Expand Down

0 comments on commit 9668658

Please sign in to comment.