mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: sentry middleware interface conversion
This commit is contained in:
@@ -146,15 +146,12 @@ func initSentry(config sentryConfig, debug bool) {
|
||||
|
||||
// returns a user id
|
||||
func getPrincipal(r *http.Request) string {
|
||||
type identifiable interface {
|
||||
Identity() string
|
||||
}
|
||||
type principalGetter interface {
|
||||
GetPrincipal() *identifiable
|
||||
type principalIdentityGetter interface {
|
||||
GetPrincipalIdentity() string
|
||||
}
|
||||
|
||||
if p := r.Context().Value("principal"); p != nil {
|
||||
return (*p.(principalGetter).GetPrincipal()).Identity()
|
||||
return p.(principalIdentityGetter).GetPrincipalIdentity()
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user