feat: Pass around one big global context
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
30
internal/context/context.go
Normal file
30
internal/context/context.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user