mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-13 07:29:30 +01:00
fix #192
This commit is contained in:
parent
73391f11a6
commit
ced3a17cd3
@ -126,6 +126,7 @@ type Server struct {
|
|||||||
signals chan os.Signal
|
signals chan os.Signal
|
||||||
snomasks *SnoManager
|
snomasks *SnoManager
|
||||||
store *buntdb.DB
|
store *buntdb.DB
|
||||||
|
storeFilename string
|
||||||
stsEnabled bool
|
stsEnabled bool
|
||||||
webirc []webircConfig
|
webirc []webircConfig
|
||||||
whoWas *WhoWasList
|
whoWas *WhoWasList
|
||||||
@ -707,9 +708,13 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
|
|||||||
return fmt.Errorf("Maximum line length (linelen) cannot be changed after launching the server, rehash aborted")
|
return fmt.Errorf("Maximum line length (linelen) cannot be changed after launching the server, rehash aborted")
|
||||||
} else if server.name != config.Server.Name {
|
} else if server.name != config.Server.Name {
|
||||||
return fmt.Errorf("Server name cannot be changed after launching the server, rehash aborted")
|
return fmt.Errorf("Server name cannot be changed after launching the server, rehash aborted")
|
||||||
|
} else if server.storeFilename != config.Datastore.Path {
|
||||||
|
return fmt.Errorf("Datastore path cannot be changed after launching the server, rehash aborted")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server.logger.Info("rehash", "Using config file", server.configFilename)
|
||||||
|
|
||||||
casefoldedName, err := Casefold(config.Server.Name)
|
casefoldedName, err := Casefold(config.Server.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Server name isn't valid [%s]: %s", config.Server.Name, err.Error())
|
return fmt.Errorf("Server name isn't valid [%s]: %s", config.Server.Name, err.Error())
|
||||||
@ -939,8 +944,10 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
|
|||||||
sendRawOutputNotice := !initial && !server.loggingRawIO && nowLoggingRawIO
|
sendRawOutputNotice := !initial && !server.loggingRawIO && nowLoggingRawIO
|
||||||
server.loggingRawIO = nowLoggingRawIO
|
server.loggingRawIO = nowLoggingRawIO
|
||||||
|
|
||||||
|
server.storeFilename = config.Datastore.Path
|
||||||
|
server.logger.Info("rehash", "Using datastore", server.storeFilename)
|
||||||
if initial {
|
if initial {
|
||||||
if err := server.loadDatastore(config.Datastore.Path); err != nil {
|
if err := server.loadDatastore(server.storeFilename); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -965,7 +972,7 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (server *Server) loadMOTD(motdPath string, useFormatting bool) error {
|
func (server *Server) loadMOTD(motdPath string, useFormatting bool) error {
|
||||||
server.logger.Debug("rehash", "Loading MOTD")
|
server.logger.Info("rehash", "Using MOTD", motdPath)
|
||||||
motdLines := make([]string, 0)
|
motdLines := make([]string, 0)
|
||||||
if motdPath != "" {
|
if motdPath != "" {
|
||||||
file, err := os.Open(motdPath)
|
file, err := os.Open(motdPath)
|
||||||
@ -1005,7 +1012,6 @@ func (server *Server) loadDatastore(datastorePath string) error {
|
|||||||
// open the datastore and load server state for which it (rather than config)
|
// open the datastore and load server state for which it (rather than config)
|
||||||
// is the source of truth
|
// is the source of truth
|
||||||
|
|
||||||
server.logger.Debug("startup", "Opening datastore")
|
|
||||||
db, err := OpenDatabase(datastorePath)
|
db, err := OpenDatabase(datastorePath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
server.store = db
|
server.store = db
|
||||||
|
Loading…
Reference in New Issue
Block a user