config
This commit is contained in:
parent
bd2f794af8
commit
a36a881129
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user