mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
0e472a347f
* fix: add sentry in ui, http and projection handlers * fix test
44 lines
801 B
Go
44 lines
801 B
Go
package ui
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
sentryhttp "github.com/getsentry/sentry-go/http"
|
|
|
|
http_util "github.com/caos/zitadel/internal/api/http"
|
|
"github.com/caos/zitadel/internal/ui/console"
|
|
"github.com/caos/zitadel/internal/ui/login"
|
|
)
|
|
|
|
const (
|
|
uiname = "ui"
|
|
)
|
|
|
|
type Config struct {
|
|
Port string
|
|
Login login.Config
|
|
Console console.Config
|
|
}
|
|
|
|
type UI struct {
|
|
port string
|
|
mux *http.ServeMux
|
|
}
|
|
|
|
func Create(config Config) *UI {
|
|
return &UI{
|
|
port: config.Port,
|
|
mux: http.NewServeMux(),
|
|
}
|
|
}
|
|
|
|
func (u *UI) RegisterHandler(prefix string, handler http.Handler) {
|
|
sentryHandler := sentryhttp.New(sentryhttp.Options{})
|
|
http_util.RegisterHandler(u.mux, prefix, sentryHandler.Handle(handler))
|
|
}
|
|
|
|
func (u *UI) Start(ctx context.Context) {
|
|
http_util.Serve(ctx, u.mux, u.port, uiname)
|
|
}
|