Geomap: Base layer server configuration (#37041)

This commit is contained in:
Eunice Kim
2021-07-21 08:54:05 -07:00
committed by GitHub
parent ec9a587cbe
commit 3b0d7fc00b
6 changed files with 59 additions and 0 deletions

View File

@ -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()