1
0
forked from MTSR/mapserver
This commit is contained in:
NatureFreshMilk 2019-01-25 13:14:49 +01:00
parent bd2f794af8
commit a36a881129
2 changed files with 13 additions and 12 deletions

View File

@ -24,15 +24,16 @@ func Setup(p params.ParamsType, cfg *Config) (*App, error) {
a.Worldconfig = worldconfig.Parse("world.mt") a.Worldconfig = worldconfig.Parse("world.mt")
logrus.WithFields(logrus.Fields{"version": Version}).Info("Starting mapserver") logrus.WithFields(logrus.Fields{"version": Version}).Info("Starting mapserver")
if a.Worldconfig.Backend != worldconfig.BACKEND_SQLITE3 {
return nil, errors.New("no supported backend found!")
}
//create db accessor
var err error var err error
a.Blockdb, err = db.NewSqliteAccessor("map.sqlite")
if err != nil { switch a.Worldconfig.Backend {
return nil, err case worldconfig.BACKEND_SQLITE3:
a.Blockdb, err = db.NewSqliteAccessor("map.sqlite")
if err != nil {
return nil, err
}
default:
return nil, errors.New("map-backend not supported: " + a.Worldconfig.Backend)
} }
//migrate block db //migrate block db

View File

@ -33,11 +33,11 @@ type WorldConfig struct {
Backend string Backend string
PlayerBackend string PlayerBackend string
PsqlConnection PsqlConfig PsqlConnection *PsqlConfig
PsqlPlayerConnection PsqlConfig PsqlPlayerConnection *PsqlConfig
} }
func parseConnectionString(str string) PsqlConfig { func parseConnectionString(str string) *PsqlConfig {
cfg := PsqlConfig{} cfg := PsqlConfig{}
pairs := strings.Split(str, " ") pairs := strings.Split(str, " ")
@ -58,7 +58,7 @@ func parseConnectionString(str string) PsqlConfig {
} }
} }
return cfg return &cfg
} }
func Parse(filename string) WorldConfig { func Parse(filename string) WorldConfig {