1
0
Fork 0
forked from External/ergo

Merge pull request #323 from slingamn/initdb.1

fix #322
This commit is contained in:
Daniel Oaks 2019-01-03 09:18:19 +10:00 committed by GitHub
commit ea970f94a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 29 deletions

View file

@ -883,6 +883,15 @@ func (server *Server) loadDatastore(config *Config) error {
// open the datastore and load server state for which it (rather than config)
// is the source of truth
_, err := os.Stat(config.Datastore.Path)
if os.IsNotExist(err) {
server.logger.Warning("rehash", "database does not exist, creating it", config.Datastore.Path)
err = initializeDB(config.Datastore.Path)
if err != nil {
return err
}
}
db, err := OpenDatabase(config)
if err == nil {
server.store = db
@ -891,7 +900,7 @@ func (server *Server) loadDatastore(config *Config) error {
}
// load *lines (from the datastores)
server.logger.Debug("startup", "Loading D/Klines")
server.logger.Debug("rehash", "Loading D/Klines")
server.loadDLines()
server.loadKLines()
@ -963,7 +972,7 @@ func (server *Server) setupListeners(config *Config) (err error) {
}
if len(tlsListeners) == 0 {
server.logger.Warning("startup", "You are not exposing an SSL/TLS listening port. You should expose at least one port (typically 6697) to accept TLS connections")
server.logger.Warning("rehash", "You are not exposing an SSL/TLS listening port. You should expose at least one port (typically 6697) to accept TLS connections")
}
var usesStandardTLSPort bool
@ -974,7 +983,7 @@ func (server *Server) setupListeners(config *Config) (err error) {
}
}
if 0 < len(tlsListeners) && !usesStandardTLSPort {
server.logger.Warning("startup", "Port 6697 is the standard TLS port for IRC. You should (also) expose port 6697 as a TLS port to ensure clients can connect securely")
server.logger.Warning("rehash", "Port 6697 is the standard TLS port for IRC. You should (also) expose port 6697 as a TLS port to ensure clients can connect securely")
}
return