htpasswd file relative to repo

This commit is contained in:
Chapuis Bertil
2015-09-07 15:32:38 +02:00
parent 738e78c439
commit ff5e60135c
2 changed files with 5 additions and 3 deletions

View File

@@ -3,11 +3,13 @@ package main
import (
"errors"
"net/http"
"path/filepath"
)
func Authorize(r *http.Request) error {
func Authorize(r *http.Request, c *Context) error {
htpasswd, err := NewHtpasswdFromFile("/tmp/restic/.htpasswd")
file := filepath.Join(c.path, ".htpasswd")
htpasswd, err := NewHtpasswdFromFile(file)
if err != nil {
return errors.New("internal server error")
}