small refactoring

This commit is contained in:
Chapuis Bertil 2015-09-06 17:44:42 +02:00
parent a6f9e71f95
commit b4d923ab26
3 changed files with 1 additions and 17 deletions

View file

@ -20,9 +20,5 @@ func Authorize(r *http.Request) error {
return errors.New("unknown user")
}
if username != repo {
return errors.New("unauthorized")
}
return nil
}

View file

@ -20,12 +20,6 @@ func NewContext(path string) Context {
return Context{path}
}
// Creates the file structure of the Context
func (c *Context) Init() error {
return nil
}
func (c *Context) Repository(name string) (Repository, error) {
name, err := ParseRepositoryName(name)
return Repository{filepath.Join(c.path, name)}, err

View file

@ -7,17 +7,11 @@ import (
)
func main() {
context := Context{"/tmp/restic"}
context := NewContext("/tmp/restic")
repo, _ := context.Repository("user")
repo.Init()
errc := context.Init()
if errc != nil {
log.Println("context initialization failed")
return
}
router := Router{context}
port := ":8000"
log.Printf("start server on port %s", port)