1
0
forked from MTSR/mapserver

psql stub

This commit is contained in:
NatureFreshMilk 2019-01-28 14:47:53 +01:00
parent c6adc74f2d
commit 81ee5d9f0f
2 changed files with 12 additions and 2 deletions

View File

@ -57,8 +57,14 @@ func Setup(p params.ParamsType, cfg *Config) (*App, error) {
//mapblock renderer
a.Mapblockrenderer = mapblockrenderer.NewMapBlockRenderer(a.BlockAccessor, a.Colormapping)
//tile database
a.Objectdb, err = mapobjectdb.NewSqliteAccessor("mapserver.sqlite")
//mapserver database
if a.Worldconfig.MapObjectConnection != nil {
//TODO: Psql connection
} else {
a.Objectdb, err = mapobjectdb.NewSqliteAccessor("mapserver.sqlite")
}
if err != nil {
return nil, err

View File

@ -19,6 +19,7 @@ const (
CONFIG_PLAYER_BACKEND string = "player_backend"
CONFIG_PSQL_CONNECTION string = "pgsql_connection"
CONFIG_PSQL_PLAYER_CONNECTION string = "pgsql_player_connection"
CONFIG_PSQL_MAPSERVER string = "pgsql_mapserver_connection"
)
type PsqlConfig struct {
@ -35,6 +36,7 @@ type WorldConfig struct {
PsqlConnection *PsqlConfig
PsqlPlayerConnection *PsqlConfig
MapObjectConnection *PsqlConfig
}
func parseConnectionString(str string) *PsqlConfig {
@ -90,6 +92,8 @@ func Parse(filename string) WorldConfig {
cfg.PsqlConnection = parseConnectionString(valueStr)
case CONFIG_PSQL_PLAYER_CONNECTION:
cfg.PsqlPlayerConnection = parseConnectionString(valueStr)
case CONFIG_PSQL_MAPSERVER:
cfg.MapObjectConnection = parseConnectionString(valueStr)
}
}