mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
config: fix connstr for remote_cache (#17675)
fixes #17643 and adds test to check for commented out lines (but will only catch `;`, not `#`).
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user