diff options
Diffstat (limited to 'cmd/cmd.go')
-rw-r--r-- | cmd/cmd.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/cmd/cmd.go b/cmd/cmd.go index b89dd5d8b8..fd713b9aff 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -16,6 +16,7 @@ import ( "syscall" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/util" @@ -57,15 +58,17 @@ func confirm() (bool, error) { } func initDB(ctx context.Context) error { - return initDBDisableConsole(ctx, false) -} - -func initDBDisableConsole(ctx context.Context, disableConsole bool) error { - setting.NewContext() + setting.LoadFromExisting() setting.InitDBConfig() - setting.NewXORMLogService(disableConsole) + setting.NewXORMLogService(false) + + if setting.Database.Type == "" { + log.Fatal(`Database settings are missing from the configuration file: %q. +Ensure you are running in the correct environment or set the correct configuration file with -c. +If this is the intended configuration file complete the [database] section.`, setting.CustomConf) + } if err := db.InitEngine(ctx); err != nil { - return fmt.Errorf("models.SetEngine: %v", err) + return fmt.Errorf("unable to initialise the database using the configuration in %q. Error: %v", setting.CustomConf, err) } return nil } |