Azure: Load custom clouds from ini file (#87667)

* Load custom clouds from config file

* Update docs

* Use the correct list of clouds, add test, fix error condition handling

* Remove on custom cloud from sample.ini and docs

* Remove unnecessary else block

* Use cached json instead of serializing with each request

* Update grafana-azure-sdk-go version to v2.0.4

* update configure-grafana entry for clouds_config

* fix lint errors

* fix lint errors

---------

Co-authored-by: Jeremy Angel (from Dev Box) <jeremyangel@microsoft.com>
This commit is contained in:
Jon Cole
2024-05-24 17:40:04 +01:00
committed by GitHub
co-authored by Jeremy Angel
parent 9f23e9a53b
commit 67b90ceba5
9 changed files with 88 additions and 3 deletions
+6
View File
@@ -72,6 +72,12 @@ func (cfg *Cfg) readAzureSettings() {
azureSettings.UserIdentityFallbackCredentialsEnabled = azureSection.Key("user_identity_fallback_credentials_enabled").MustBool(true)
}
if customCloudsJSON := azureSection.Key("clouds_config").MustString(""); customCloudsJSON != "" {
if err := azureSettings.SetCustomClouds(customCloudsJSON); err != nil {
cfg.Logger.Error("Failed to parse custom Azure cloud settings", "err", err.Error())
}
}
azureSettings.ForwardSettingsPlugins = util.SplitString(azureSection.Key("forward_settings_to_plugins").String())
cfg.Azure = azureSettings