forked from TrueCloudLab/restic
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"
|
"strings"
|
||||||
|
|
||||||
"restic/backend/local"
|
"restic/backend/local"
|
||||||
|
"restic/backend/rest"
|
||||||
"restic/backend/s3"
|
"restic/backend/s3"
|
||||||
"restic/backend/sftp"
|
"restic/backend/sftp"
|
||||||
)
|
)
|
||||||
|
@ -27,6 +28,7 @@ var parsers = []parser{
|
||||||
{"local", local.ParseConfig},
|
{"local", local.ParseConfig},
|
||||||
{"sftp", sftp.ParseConfig},
|
{"sftp", sftp.ParseConfig},
|
||||||
{"s3", s3.ParseConfig},
|
{"s3", s3.ParseConfig},
|
||||||
|
{"rest", rest.ParseConfig},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse extracts repository location information from the string s. If s
|
// Parse extracts repository location information from the string s. If s
|
||||||
|
|
|
@ -1,13 +1,24 @@
|
||||||
package location
|
package location
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/url"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"restic/backend/rest"
|
||||||
"restic/backend/s3"
|
"restic/backend/s3"
|
||||||
"restic/backend/sftp"
|
"restic/backend/sftp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func parseURL(s string) *url.URL {
|
||||||
|
u, err := url.Parse(s)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return u
|
||||||
|
}
|
||||||
|
|
||||||
var parseTests = []struct {
|
var parseTests = []struct {
|
||||||
s string
|
s string
|
||||||
u Location
|
u Location
|
||||||
|
@ -101,6 +112,11 @@ var parseTests = []struct {
|
||||||
UseHTTP: true,
|
UseHTTP: true,
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
|
{"rest:http://hostname.foo:1234/", Location{Scheme: "rest",
|
||||||
|
Config: rest.Config{
|
||||||
|
URL: parseURL("http://hostname.foo:1234/"),
|
||||||
|
}},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParse(t *testing.T) {
|
func TestParse(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue