forked from TrueCloudLab/rclone
rc: take note of the --rc-addr flag too as per the docs - fixes #2184
This commit is contained in:
parent
849db6699d
commit
d8e88f10cd
1 changed files with 9 additions and 0 deletions
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/ncw/rclone/fs/rc"
|
"github.com/ncw/rclone/fs/rc"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -57,6 +58,14 @@ func doCall(path string, in rc.Params) (out rc.Params, err error) {
|
||||||
// Do HTTP request
|
// Do HTTP request
|
||||||
client := fshttp.NewClient(fs.Config)
|
client := fshttp.NewClient(fs.Config)
|
||||||
url := url
|
url := url
|
||||||
|
// set the user use --rc-addr as well as --url
|
||||||
|
if rcAddrFlag := pflag.Lookup("rc-addr"); rcAddrFlag != nil && rcAddrFlag.Changed {
|
||||||
|
url = rcAddrFlag.Value.String()
|
||||||
|
if strings.HasPrefix(url, ":") {
|
||||||
|
url = "localhost" + url
|
||||||
|
}
|
||||||
|
url = "http://" + url + "/"
|
||||||
|
}
|
||||||
if !strings.HasSuffix(url, "/") {
|
if !strings.HasSuffix(url, "/") {
|
||||||
url += "/"
|
url += "/"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue