mirror of
https://github.com/rclone/rclone.git
synced 2025-01-19 04:39:27 +01:00
union: backward compatible to old config
This commit is contained in:
parent
f0c17a72db
commit
6898a0cccd
@ -29,21 +29,21 @@ func init() {
|
|||||||
NewFs: NewFs,
|
NewFs: NewFs,
|
||||||
Options: []fs.Option{{
|
Options: []fs.Option{{
|
||||||
Name: "upstreams",
|
Name: "upstreams",
|
||||||
Help: "List of space separated upstreams.\nCan be 'upstreama:test/dir upstreamb:', '\"remotea:test/space:ro dir\" remoteb:', etc.\n",
|
Help: "List of space separated upstreams.\nCan be 'upstreama:test/dir upstreamb:', '\"upstreama:test/space:ro dir\" upstreamb:', etc.\n",
|
||||||
Required: true,
|
Required: true,
|
||||||
}, {
|
}, {
|
||||||
Name: "action_policy",
|
Name: "action_policy",
|
||||||
Help: "Policy to choose upstream on ACTION class.",
|
Help: "Policy to choose upstream on ACTION category.",
|
||||||
Required: true,
|
Required: true,
|
||||||
Default: "epall",
|
Default: "epall",
|
||||||
}, {
|
}, {
|
||||||
Name: "create_policy",
|
Name: "create_policy",
|
||||||
Help: "Policy to choose upstream on CREATE class.",
|
Help: "Policy to choose upstream on CREATE category.",
|
||||||
Required: true,
|
Required: true,
|
||||||
Default: "epmfs",
|
Default: "epmfs",
|
||||||
}, {
|
}, {
|
||||||
Name: "search_policy",
|
Name: "search_policy",
|
||||||
Help: "Policy to choose upstream on SEARCH class.",
|
Help: "Policy to choose upstream on SEARCH category.",
|
||||||
Required: true,
|
Required: true,
|
||||||
Default: "ff",
|
Default: "ff",
|
||||||
}, {
|
}, {
|
||||||
@ -59,6 +59,7 @@ func init() {
|
|||||||
// Options defines the configuration for this backend
|
// Options defines the configuration for this backend
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Upstreams fs.SpaceSepList `config:"upstreams"`
|
Upstreams fs.SpaceSepList `config:"upstreams"`
|
||||||
|
Remotes fs.SpaceSepList `config:"remotes"` // Depreated
|
||||||
ActionPolicy string `config:"action_policy"`
|
ActionPolicy string `config:"action_policy"`
|
||||||
CreatePolicy string `config:"create_policy"`
|
CreatePolicy string `config:"create_policy"`
|
||||||
SearchPolicy string `config:"search_policy"`
|
SearchPolicy string `config:"search_policy"`
|
||||||
@ -644,6 +645,13 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// Backward compatible to old config
|
||||||
|
if len(opt.Upstreams) == 0 && len(opt.Remotes) > 0 {
|
||||||
|
for i := 0; i < len(opt.Remotes)-1; i++ {
|
||||||
|
opt.Remotes[i] = opt.Remotes[i] + ":ro"
|
||||||
|
}
|
||||||
|
opt.Upstreams = opt.Remotes
|
||||||
|
}
|
||||||
if len(opt.Upstreams) == 0 {
|
if len(opt.Upstreams) == 0 {
|
||||||
return nil, errors.New("union can't point to an empty upstream - check the value of the upstreams setting")
|
return nil, errors.New("union can't point to an empty upstream - check the value of the upstreams setting")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user