support baidu map

This commit is contained in:
MaysWind
2023-06-17 17:48:39 +08:00
parent 3bae6e749a
commit 782e3a85f9
12 changed files with 312 additions and 77 deletions
+5
View File
@@ -65,6 +65,7 @@ const (
// Map provider types
const (
OpenStreetMapProvider string = "openstreetmap"
BaiduMapProvider string = "baidumap"
)
// Exchange rates data source types
@@ -176,6 +177,7 @@ type Config struct {
// Map
MapProvider string
BaiduMapAK string
EnableMapDataFetchProxy bool
// Exchange Rates
@@ -436,11 +438,14 @@ func loadMapConfiguration(config *Config, configFile *ini.File, sectionName stri
config.MapProvider = ""
} else if getConfigItemStringValue(configFile, sectionName, "map_provider") == OpenStreetMapProvider {
config.MapProvider = OpenStreetMapProvider
} else if getConfigItemStringValue(configFile, sectionName, "map_provider") == BaiduMapProvider {
config.MapProvider = BaiduMapProvider
} else {
return errs.ErrInvalidMapProvider
}
config.EnableMapDataFetchProxy = getConfigItemBoolValue(configFile, sectionName, "map_data_fetch_proxy", false)
config.BaiduMapAK = getConfigItemStringValue(configFile, sectionName, "baidu_map_ak")
return nil
}