From 32c5fd987a06e11b14a4247d13187657c14adedd Mon Sep 17 00:00:00 2001 From: Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 19 Apr 2021 19:42:19 +0200 Subject: Api/v1/statuses (#11) This PR adds: Statuses New status creation. View existing status Delete a status Fave a status Unfave a status See who's faved a status Media Upload media attachment and store/retrieve it Upload custom emoji and store/retrieve it Fileserver Serve files from storage Testing Test models, testrig -- run a GTS test instance and play around with it. --- internal/router/router.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'internal/router/router.go') diff --git a/internal/router/router.go b/internal/router/router.go index ce924b26d..7ab208ef6 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -83,7 +83,17 @@ func (r *router) AttachMiddleware(middleware gin.HandlerFunc) { // New returns a new Router with the specified configuration, using the given logrus logger. func New(config *config.Config, logger *logrus.Logger) (Router, error) { - engine := gin.New() + lvl, err := logrus.ParseLevel(config.LogLevel) + if err != nil { + return nil, fmt.Errorf("couldn't parse log level %s to set router level: %s", config.LogLevel, err) + } + switch lvl { + case logrus.TraceLevel, logrus.DebugLevel: + gin.SetMode(gin.DebugMode) + default: + gin.SetMode(gin.ReleaseMode) + } + engine := gin.Default() // create a new session store middleware store, err := sessionStore() -- cgit v1.2.3