feat: more reorganisation and keys endpoint
This commit is contained in:
@@ -19,14 +19,18 @@ func KickoffApi(logger *slog.Logger, env bootstrap.Environment, db *gorm.DB) {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
|
||||
// For a nice looking logger:
|
||||
// r := gin.Default()
|
||||
// JSON logger: https://gin-gonic.com/en/docs/logging/structured-logging/
|
||||
// r := gin.Default() // default, this makes a nice looking log-trace but I want JSON
|
||||
r := gin.New()
|
||||
r.Use(middleware.SlogMiddleware(logger))
|
||||
r.Use(gin.Recovery())
|
||||
|
||||
if env.AuthenticationEnabled {
|
||||
slog.Debug("activating authentication middleware") // only log when actually doign the thing it logs to do
|
||||
r.Use(middleware.AuthMiddleware())
|
||||
}
|
||||
|
||||
api := r.Group("/api")
|
||||
routes.RegisterApiRoutes(api /*env,*/, db)
|
||||
routes.RegisterApiRoutes(api, db)
|
||||
|
||||
file := r.Group("/file")
|
||||
routes.RegisterFileRoutes(file, env, db)
|
||||
|
||||
Reference in New Issue
Block a user