feat: Pass around one big global context
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2024-02-03 12:05:10 +01:00
parent cb123537d5
commit 315bb39f44
5 changed files with 183 additions and 44 deletions

View File

@@ -0,0 +1,30 @@
package context
import (
"net/http"
"git.polynom.me/rio/internal/metrics"
"git.polynom.me/rio/internal/repo"
)
type GlobalContext struct {
DefaultCSP string
PagesDomain string
Gitea *repo.GiteaClient
MetricConfig *metrics.LokiMetricConfig
}
type Context struct {
Username string
Reponame string
Domain string
Path string
// HTTP Stuff
Referrer string
UserAgent string
Writer http.ResponseWriter
// Pointer to the global context
Global *GlobalContext
}