Merge branch 'master' into alerting_definitions

Conflicts:
	conf/defaults.ini
	pkg/api/dashboard.go
This commit is contained in:
Torkel Ödegaard
2016-06-06 08:43:01 +02:00
49 changed files with 5530 additions and 223 deletions

View File

@@ -37,9 +37,10 @@ const (
var (
// App settings.
Env string = DEV
AppUrl string
AppSubUrl string
Env string = DEV
AppUrl string
AppSubUrl string
InstanceName string
// build
BuildVersion string
@@ -262,6 +263,12 @@ func evalEnvVarExpression(value string) string {
envVar = strings.TrimPrefix(envVar, "${")
envVar = strings.TrimSuffix(envVar, "}")
envValue := os.Getenv(envVar)
// if env variable is hostname and it is emtpy use os.Hostname as default
if envVar == "HOSTNAME" && envValue == "" {
envValue, _ = os.Hostname()
}
return envValue
})
}
@@ -398,11 +405,28 @@ func validateStaticRootPath() error {
return fmt.Errorf("Failed to detect generated css or javascript files in static root (%s), have you executed default grunt task?", StaticRootPath)
}
// func readInstanceName() string {
// hostname, _ := os.Hostname()
// if hostname == "" {
// hostname = "hostname_unknown"
// }
//
// instanceName := Cfg.Section("").Key("instance_name").MustString("")
// if instanceName = "" {
// // set value as it might be used in other places
// Cfg.Section("").Key("instance_name").SetValue(hostname)
// instanceName = hostname
// }
//
// return
// }
func NewConfigContext(args *CommandLineArgs) error {
setHomePath(args)
loadConfiguration(args)
Env = Cfg.Section("").Key("app_mode").MustString("development")
InstanceName = Cfg.Section("").Key("instance_name").MustString("unknown_instance_name")
PluginsPath = Cfg.Section("paths").Key("plugins").String()
server := Cfg.Section("server")