forked from MTSR/mapserver
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")
|
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
|
||||||
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user