From bbd775bcc6ac11f034e214b0d4891baf386ce532 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Thu, 20 Jun 2019 09:04:52 -0400 Subject: [PATCH] Always initialize database after --config Previously, this would only run when configuring an instance for single-user usage. Now it'll also run when configuring for multi-user usage. It also adds a log when the database has already been initialized. --- app.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app.go b/app.go index 8aeedce..7b149cc 100644 --- a/app.go +++ b/app.go @@ -449,19 +449,21 @@ func DoConfig(app *App) { log.Error("Unable to configure: %v", err) os.Exit(1) } - if d.User != nil { - app.cfg = d.Config - connectToDatabase(app) - defer shutdown(app) + app.cfg = d.Config + connectToDatabase(app) + defer shutdown(app) - if !app.db.DatabaseInitialized() { - err = adminInitDatabase(app) - if err != nil { - log.Error(err.Error()) - os.Exit(1) - } + if !app.db.DatabaseInitialized() { + err = adminInitDatabase(app) + if err != nil { + log.Error(err.Error()) + os.Exit(1) } + } else { + log.Info("Database already initialized.") + } + if d.User != nil { u := &User{ Username: d.User.Username, HashedPass: d.User.HashedPass,