mirror of
https://github.com/restic/restic.git
synced 2024-12-23 08:16:36 +00:00
Add rest backend to location
This commit is contained in:
parent
c2348ba768
commit
ec34da2d66
2 changed files with 18 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"restic/backend/local"
|
||||
"restic/backend/rest"
|
||||
"restic/backend/s3"
|
||||
"restic/backend/sftp"
|
||||
)
|
||||
|
@ -27,6 +28,7 @@ var parsers = []parser{
|
|||
{"local", local.ParseConfig},
|
||||
{"sftp", sftp.ParseConfig},
|
||||
{"s3", s3.ParseConfig},
|
||||
{"rest", rest.ParseConfig},
|
||||
}
|
||||
|
||||
// Parse extracts repository location information from the string s. If s
|
||||
|
|
|
@ -1,13 +1,24 @@
|
|||
package location
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"restic/backend/rest"
|
||||
"restic/backend/s3"
|
||||
"restic/backend/sftp"
|
||||
)
|
||||
|
||||
func parseURL(s string) *url.URL {
|
||||
u, err := url.Parse(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return u
|
||||
}
|
||||
|
||||
var parseTests = []struct {
|
||||
s string
|
||||
u Location
|
||||
|
@ -101,6 +112,11 @@ var parseTests = []struct {
|
|||
UseHTTP: true,
|
||||
}},
|
||||
},
|
||||
{"rest:http://hostname.foo:1234/", Location{Scheme: "rest",
|
||||
Config: rest.Config{
|
||||
URL: parseURL("http://hostname.foo:1234/"),
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
func TestParse(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue