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 {
64
64
func NewHandler (server * Server ) (http.Handler , error ) {
65
65
if ! server .NoAuth {
66
66
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 )
68
75
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 )
70
77
}
71
78
}
72
79
You can’t perform that action at this time.
0 commit comments