restic/src/restic/backend/local/config.go

22 lines
408 B
Go
Raw Normal View History

2015-12-28 09:51:24 -05:00
package local
import (
"strings"
2016-09-01 16:17:37 -04:00
"restic/errors"
2015-12-28 09:51:24 -05:00
)
2017-03-25 08:20:03 -04:00
// Config holds all information needed to open a local repository.
type Config struct {
Path string
}
2015-12-28 09:51:24 -05:00
// ParseConfig parses a local backend config.
func ParseConfig(cfg string) (interface{}, error) {
if !strings.HasPrefix(cfg, "local:") {
return nil, errors.New(`invalid format, prefix "local" not found`)
}
2017-03-25 08:20:03 -04:00
return Config{Path: cfg[6:]}, nil
2015-12-28 09:51:24 -05:00
}