File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,16 @@ func (s *Server) wrapMetricsAuth(f http.HandlerFunc) http.HandlerFunc {
6464func NewHandler (server * Server ) (http.Handler , error ) {
6565 if ! server .NoAuth {
6666 var err error
67- server .htpasswdFile , err = NewHtpasswdFromFile (filepath .Join (server .Path , ".htpasswd" ))
67+ htpasswd := server .Config .Auth .HTPasswdFile
68+ if htpasswd == "" {
69+ htpasswd = ".htpasswd"
70+ }
71+ if ! filepath .IsAbs (htpasswd ) {
72+ htpasswd = filepath .Join (server .Path , htpasswd )
73+ }
74+ server .htpasswdFile , err = NewHtpasswdFromFile (htpasswd )
6875 if err != nil {
69- return nil , fmt .Errorf ("cannot load . htpasswd (use --no-auth to disable): %v" , err )
76+ return nil , fmt .Errorf ("cannot load htpasswd file (use --no-auth to disable): %s: %v" , htpasswd , err )
7077 }
7178 }
7279
You can’t perform that action at this time.
0 commit comments