diff --git a/conf/defaults.ini b/conf/defaults.ini index af362157aea..6f1b57d0b48 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -118,7 +118,7 @@ type = database # database: will use Grafana primary database. # redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0`. Only addr is required. # memcache: 127.0.0.1:11211 -;connstr = +connstr = #################################### Data proxy ########################### [dataproxy] diff --git a/pkg/setting/setting_test.go b/pkg/setting/setting_test.go index f59e4d6e8aa..73425a82263 100644 --- a/pkg/setting/setting_test.go +++ b/pkg/setting/setting_test.go @@ -1,10 +1,12 @@ package setting import ( + "bufio" "os" "path" "path/filepath" "runtime" + "strings" "testing" "gopkg.in/ini.v1" @@ -30,6 +32,22 @@ func TestLoadingSettings(t *testing.T) { So(cfg.RendererCallbackUrl, ShouldEqual, "http://localhost:3000/") }) + Convey("default.ini should have no semi-colon commented entries", func() { + file, err := os.Open("../../conf/defaults.ini") + if err != nil { + t.Errorf("failed to load defaults.ini file: %v", err) + } + defer file.Close() + + scanner := bufio.NewScanner(file) + for scanner.Scan() { + // This only catches values commented out with ";" and will not catch those that are commented out with "#". + if strings.HasPrefix(scanner.Text(), ";") { + t.Errorf("entries in defaults.ini must not be commented or environment variables will not work: %v", scanner.Text()) + } + } + }) + Convey("Should be able to override via environment variables", func() { os.Setenv("GF_SECURITY_ADMIN_USER", "superduper")