mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CLI: Fix config flag being ignored
Passing --config had no effect when passed. It will now be applied as the last config file and before any env var overrrides.
This commit is contained in:
@@ -164,9 +164,13 @@ func loadEnvVariableOverrides() {
|
||||
}
|
||||
}
|
||||
|
||||
func NewConfigContext() {
|
||||
func NewConfigContext(config string) {
|
||||
configFiles := findConfigFiles()
|
||||
|
||||
if config != "" {
|
||||
configFiles = append(configFiles, config)
|
||||
}
|
||||
|
||||
//log.Info("Loading config files: %v", configFiles)
|
||||
var err error
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ func TestLoadingSettings(t *testing.T) {
|
||||
Convey("Testing loading settings from ini file", t, func() {
|
||||
|
||||
Convey("Given the default ini files", func() {
|
||||
NewConfigContext()
|
||||
NewConfigContext("")
|
||||
|
||||
So(AppName, ShouldEqual, "Grafana")
|
||||
So(AdminUser, ShouldEqual, "admin")
|
||||
@@ -23,7 +23,7 @@ func TestLoadingSettings(t *testing.T) {
|
||||
|
||||
Convey("Should be able to override via environment variables", func() {
|
||||
os.Setenv("GF_SECURITY_ADMIN_USER", "superduper")
|
||||
NewConfigContext()
|
||||
NewConfigContext("")
|
||||
|
||||
So(AdminUser, ShouldEqual, "superduper")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user