mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' into alerting_definitions
Conflicts: conf/defaults.ini pkg/api/dashboard.go
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user