Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config: Fix connectionstring for remote_cache in defaults.ini #17675

Merged
merged 3 commits into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
18 changes: 18 additions & 0 deletions pkg/setting/setting_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package setting

import (
"bufio"
"os"
"path"
"path/filepath"
"runtime"
"strings"
"testing"

"gopkg.in/ini.v1"
Expand All @@ -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(), ";") {
kylebrandt marked this conversation as resolved.
Show resolved Hide resolved
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")

Expand Down