mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 07:32:13 +08:00
Geomap: Base layer server configuration (#37041)
This commit is contained in:
@ -5,6 +5,7 @@ package setting
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@ -400,6 +401,10 @@ type Cfg struct {
|
||||
|
||||
// Grafana.com URL
|
||||
GrafanaComURL string
|
||||
|
||||
// Geomap plugin tile server
|
||||
DefaultBaseLayer map[string]interface{}
|
||||
DisableCustomBaseLayers bool
|
||||
}
|
||||
|
||||
// IsLiveConfigEnabled returns true if live should be able to save configs to SQL tables
|
||||
@ -966,6 +971,18 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
|
||||
ConnStr: connStr,
|
||||
}
|
||||
|
||||
geomapSection := iniFile.Section("geomap")
|
||||
basemapJSON := valueAsString(geomapSection, "default_baselayer", "")
|
||||
cfg.DefaultBaseLayer = make(map[string]interface{})
|
||||
if basemapJSON != "" {
|
||||
err = json.Unmarshal([]byte(basemapJSON), &cfg.DefaultBaseLayer)
|
||||
if err != nil {
|
||||
cfg.Logger.Error(fmt.Sprintf("Error parsing JSON string: %s", err))
|
||||
cfg.DefaultBaseLayer = nil
|
||||
}
|
||||
}
|
||||
cfg.DisableCustomBaseLayers = geomapSection.Key("disable_custom_baselayers").MustBool(false)
|
||||
|
||||
cfg.readDateFormats()
|
||||
cfg.readSentryConfig()
|
||||
|
||||
|
Reference in New Issue
Block a user