From bc9ac1199bfea69c7974140fde58e5e118efc1fb Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Thu, 22 Jul 2021 17:25:47 +0200 Subject: [PATCH] fix sample.ini (#37106) (#37107) (cherry picked from commit 6b2d33dc14668a85685f8c4fd7df8343ed9b63aa) Co-authored-by: Alexander Emelin --- conf/sample.ini | 12 ++++++------ pkg/setting/setting_test.go | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/conf/sample.ini b/conf/sample.ini index fa5123a2de8..241f85c69c4 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -995,12 +995,12 @@ [geomap] # Set the JSON configuration for the default basemap ;default_baselayer_config = `{ - "type": "xyz", - "config": { - "attribution": "Open street map", - "url": "https://tile.openstreetmap.org/{z}/{x}/{y}.png" - } -}` +; "type": "xyz", +; "config": { +; "attribution": "Open street map", +; "url": "https://tile.openstreetmap.org/{z}/{x}/{y}.png" +; } +;}` # Enable or disable loading other base map layers ;enable_custom_baselayers = true diff --git a/pkg/setting/setting_test.go b/pkg/setting/setting_test.go index 9a3d5ae6d35..411d10b69c7 100644 --- a/pkg/setting/setting_test.go +++ b/pkg/setting/setting_test.go @@ -54,6 +54,16 @@ func TestLoadingSettings(t *testing.T) { } }) + Convey("sample.ini should load successfully", func() { + customInitPath := CustomInitPath + CustomInitPath = "conf/sample.ini" + cfg := NewCfg() + err := cfg.Load(&CommandLineArgs{HomePath: "../../"}) + So(err, ShouldBeNil) + // Restore CustomInitPath to avoid side effects. + CustomInitPath = customInitPath + }) + Convey("Should be able to override via environment variables", func() { err := os.Setenv("GF_SECURITY_ADMIN_USER", "superduper") require.NoError(t, err)