Configuration: Fix env var override of sections containing hyphen (#25178)
Fixes so that ini-sections containing hyphen is replaced with
underscore. Fixes an issue with backend plugin settings.
Ref grafana/grafana-image-renderer#147
(cherry picked from commit 34d5ffa562)
This commit is contained in:
committed by
Marcus Andersson
parent
9bc12846a2
commit
ec2e951cd3
@@ -373,6 +373,7 @@ func applyEnvVariableOverrides(file *ini.File) error {
|
||||
|
||||
func envKey(sectionName string, keyName string) string {
|
||||
sN := strings.ToUpper(strings.Replace(sectionName, ".", "_", -1))
|
||||
sN = strings.Replace(sN, "-", "_", -1)
|
||||
kN := strings.ToUpper(strings.Replace(keyName, ".", "_", -1))
|
||||
envKey := fmt.Sprintf("GF_%s_%s", sN, kN)
|
||||
return envKey
|
||||
|
||||
Reference in New Issue
Block a user