diff --git a/server/app/setup.go b/server/app/setup.go index b8a28cd..c8639c6 100644 --- a/server/app/setup.go +++ b/server/app/setup.go @@ -24,15 +24,16 @@ func Setup(p params.ParamsType, cfg *Config) (*App, error) { a.Worldconfig = worldconfig.Parse("world.mt") 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 - a.Blockdb, err = db.NewSqliteAccessor("map.sqlite") - if err != nil { - return nil, err + + switch a.Worldconfig.Backend { + 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 diff --git a/server/worldconfig/parse.go b/server/worldconfig/parse.go index f318a08..eb7d536 100644 --- a/server/worldconfig/parse.go +++ b/server/worldconfig/parse.go @@ -33,11 +33,11 @@ type WorldConfig struct { Backend string PlayerBackend string - PsqlConnection PsqlConfig - PsqlPlayerConnection PsqlConfig + PsqlConnection *PsqlConfig + PsqlPlayerConnection *PsqlConfig } -func parseConnectionString(str string) PsqlConfig { +func parseConnectionString(str string) *PsqlConfig { cfg := PsqlConfig{} pairs := strings.Split(str, " ") @@ -58,7 +58,7 @@ func parseConnectionString(str string) PsqlConfig { } } - return cfg + return &cfg } func Parse(filename string) WorldConfig {