(e *gin.Engine, cfg *config.Config)
| 79 | } |
| 80 | |
| 81 | func initDB(e *gin.Engine, cfg *config.Config) (st *gorp.DbMap, err error) { |
| 82 | st, err = storage.NewDatabase(cfg.Storage) |
| 83 | if err != nil { |
| 84 | return |
| 85 | } |
| 86 | |
| 87 | // add tables |
| 88 | model.AddTables(st) |
| 89 | |
| 90 | // create table if not exists |
| 91 | if err = st.CreateTablesIfNotExists(); err != nil { |
| 92 | return |
| 93 | } |
| 94 | |
| 95 | e.Use(func(c *gin.Context) { |
| 96 | c.Set("db", st) |
| 97 | c.Next() |
| 98 | }) |
| 99 | |
| 100 | return |
| 101 | } |
| 102 | |
| 103 | func initAuth(e *gin.Engine, cfg *config.Config) (authz *auth.AdminAuth) { |
| 104 | authz = auth.NewAdminAuth(cfg.AdminAuth) |
no test coverage detected