feat(server): Handle creation of a webserver
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Matthieu 'JP' DERASSE
2023-01-09 19:44:29 +00:00
parent adc5055da4
commit 44ff19e779
5 changed files with 95 additions and 2 deletions

2
commonctx/README.md Normal file
View File

@ -0,0 +1,2 @@
# Common Context
Contain code that will make work with context easier

17
commonctx/logger.go Normal file
View File

@ -0,0 +1,17 @@
package commonctx
import (
"context"
"github.com/sirupsen/logrus"
)
const LoggerKey = "mainLogger"
func AddMainLogger(ctx context.Context, logger *logrus.Logger) context.Context {
return context.WithValue(ctx, LoggerKey, logger)
}
func GetLogger(ctx context.Context) *logrus.Logger {
return ctx.Value(LoggerKey).(*logrus.Logger)
}