fix panic caused by auth logger
This commit is contained in:
parent
6546f4a905
commit
00e4ece170
@ -23,7 +23,7 @@ type options struct {
|
|||||||
|
|
||||||
type Option func(opts *options)
|
type Option func(opts *options)
|
||||||
|
|
||||||
func AuthsPeriodOption(auths map[string]string) Option {
|
func AuthsOption(auths map[string]string) Option {
|
||||||
return func(opts *options) {
|
return func(opts *options) {
|
||||||
opts.auths = auths
|
opts.auths = auths
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ func ParseAuther(cfg *config.AutherConfig) auth.Authenticator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
opts := []auth_impl.Option{
|
opts := []auth_impl.Option{
|
||||||
auth_impl.AuthsPeriodOption(m),
|
auth_impl.AuthsOption(m),
|
||||||
auth_impl.ReloadPeriodOption(cfg.Reload),
|
auth_impl.ReloadPeriodOption(cfg.Reload),
|
||||||
auth_impl.LoggerOption(logger.Default().WithFields(map[string]any{
|
auth_impl.LoggerOption(logger.Default().WithFields(map[string]any{
|
||||||
"kind": "auther",
|
"kind": "auther",
|
||||||
@ -67,11 +67,15 @@ func ParseAutherFromAuth(au *config.AuthConfig) auth.Authenticator {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return auth_impl.NewAuthenticator(
|
return auth_impl.NewAuthenticator(
|
||||||
auth_impl.AuthsPeriodOption(
|
auth_impl.AuthsOption(
|
||||||
map[string]string{
|
map[string]string{
|
||||||
au.Username: au.Password,
|
au.Username: au.Password,
|
||||||
},
|
},
|
||||||
))
|
),
|
||||||
|
auth_impl.LoggerOption(logger.Default().WithFields(map[string]any{
|
||||||
|
"kind": "auther",
|
||||||
|
})),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseAuth(cfg *config.AuthConfig) *url.Userinfo {
|
func parseAuth(cfg *config.AuthConfig) *url.Userinfo {
|
||||||
|
Loading…
Reference in New Issue
Block a user