First release of open core
This commit is contained in:
34
pkg/server/app.go
Normal file
34
pkg/server/app.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"epigas.gitea.cloud/RiskRancher/core/pkg/domain"
|
||||
"epigas.gitea.cloud/RiskRancher/core/pkg/sla"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
Store domain.Store
|
||||
Router *http.ServeMux
|
||||
Auth domain.Authenticator
|
||||
SLA domain.SLACalculator
|
||||
}
|
||||
|
||||
type FreeAuth struct{}
|
||||
|
||||
func (f *FreeAuth) Middleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// In the OSS version, we just pass the request to the next handler for now.
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
// NewApp creates a Risk Rancher Core application with OSS defaults.
|
||||
func NewApp(store domain.Store) *App {
|
||||
return &App{
|
||||
Store: store,
|
||||
Router: http.NewServeMux(),
|
||||
Auth: &FreeAuth{},
|
||||
SLA: sla.NewSLACalculator(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user