Configuration file options can now be overriden using environment variables using GF_<SectionName>_<KeyName> syntax, if Section name contains dots in config they are replaced with underscores, and the section name and keyname needs to be all upper case, #1473

This commit is contained in:
Torkel Ödegaard
2015-02-12 13:31:41 +01:00
parent 2c16b0f0f3
commit 79f798f67b
3 changed files with 28 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package setting
import (
"os"
"path/filepath"
"testing"
@ -17,6 +18,15 @@ func TestLoadingSettings(t *testing.T) {
NewConfigContext()
So(AppName, ShouldEqual, "Grafana")
So(AdminUser, ShouldEqual, "admin")
})
Convey("Should be able to override via environment variables", func() {
os.Setenv("GF_SECURITY_ADMIN_USER", "superduper")
NewConfigContext()
So(AdminUser, ShouldEqual, "superduper")
})
})
}