diff --git a/app/echoSettings.go b/app/echoSettings.go index bd79081..d5c5136 100644 --- a/app/echoSettings.go +++ b/app/echoSettings.go @@ -40,6 +40,13 @@ func (a *App) SetEchoSettings() { // TODO: have this in the config. e.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(20))) + // TODO: add check for prometheus config setting. + // if true { + // // import "github.com/labstack/echo-contrib/prometheus" + // p := prometheus.NewPrometheus("echo", nil) + // p.Use(e) + // } + e.Use(middleware.Recover()) e.Use(session.Middleware( diff --git a/run.go b/run.go index 0853c28..d7ccac9 100644 --- a/run.go +++ b/run.go @@ -120,11 +120,12 @@ func run() error { case dbtype != "postgres" && dbtype != "sqlite3": log.Errorf("unsupported DB type specified, bailing...") return errUnsupportedDBType - } - setting.SetDbConnstring(connstr) - // type can be one of "postgres" or "sqlite3". - setting.SetDbType(dbtype) + default: + setting.SetDbConnstring(connstr) + // type can be one of "postgres" or "sqlite3". + setting.SetDbType(dbtype) + } log.Infof("connecting to db at '%s'", connstr) @@ -138,8 +139,7 @@ func run() error { log.Info("making sure that the db is set up") - err = moddb.SetUp(ctx, db) - if err != nil { + if err = moddb.SetUp(ctx, db); err != nil { return err } @@ -153,30 +153,16 @@ func run() error { a := &app.App{} - err = a.Init(setting, slogger, db) - if err != nil { + if err = a.Init(setting, slogger, db); err != nil { return err } a.PrintConfiguration() - a.SetEmbeds(templates, assets) - a.SetupRoutes() - a.SetEchoSettings() - // a.SetConfig(conf) - - // // TODO: add check for prometheus config setting. - // if true { - // // import "github.com/labstack/echo-contrib/prometheus" - // p := prometheus.NewPrometheus("echo", nil) - // p.Use(e) - // } - e := a.E() - // channel used to check whether the app had troubles starting up. started := make(chan error, 1)