From b22bcb6f0a6ec7b44333e890330702d1aac0137b Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 18 May 2023 09:44:01 -0700 Subject: [PATCH] app/vmauth: allow -auth.config without `users` section of `unauthorized_user` section is present here Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4083 --- app/vmauth/auth_config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/vmauth/auth_config.go b/app/vmauth/auth_config.go index 2b3a7a31b..8e9dad467 100644 --- a/app/vmauth/auth_config.go +++ b/app/vmauth/auth_config.go @@ -392,8 +392,8 @@ func parseAuthConfig(data []byte) (*AuthConfig, error) { func parseAuthConfigUsers(ac *AuthConfig) (map[string]*UserInfo, error) { uis := ac.Users - if len(uis) == 0 { - return nil, fmt.Errorf("`users` section cannot be empty in AuthConfig") + if len(uis) == 0 && ac.UnauthorizedUser == nil { + return nil, fmt.Errorf("Missing `users` or `unauthorized_user` sections") } byAuthToken := make(map[string]*UserInfo, len(uis)) for i := range uis {