summaryrefslogtreecommitdiff
path: root/internal/router/router.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-04-19 19:42:19 +0200
committerLibravatar GitHub <noreply@github.com>2021-04-19 19:42:19 +0200
commit32c5fd987a06e11b14a4247d13187657c14adedd (patch)
treef5b787ca0f020bea5fd020925e52d3592a77a6ad /internal/router/router.go
parentApi/v1/accounts (#8) (diff)
downloadgotosocial-32c5fd987a06e11b14a4247d13187657c14adedd.tar.xz
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.
Diffstat (limited to 'internal/router/router.go')
-rw-r--r--internal/router/router.go12
1 files changed, 11 insertions, 1 deletions
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()