backends: make sure backends expand ~ and environment vars in file names they use

See: https://forum.rclone.org/t/relative-path-in-rclone-config-service-account-json/16693
This commit is contained in:
Nick Craig-Wood 2020-06-02 11:54:52 +01:00
parent b62d08d136
commit 973e3d6a7b
5 changed files with 13 additions and 8 deletions

View file

@ -26,6 +26,7 @@ import (
"time"
"github.com/rclone/rclone/lib/encoder"
"github.com/rclone/rclone/lib/env"
"github.com/rclone/rclone/lib/jwtutil"
"github.com/youmark/pkcs8"
@ -112,7 +113,7 @@ func init() {
Advanced: true,
}, {
Name: "box_config_file",
Help: "Box App config.json location\nLeave blank normally.",
Help: "Box App config.json location\nLeave blank normally." + env.ShellExpandHelp,
}, {
Name: "box_sub_type",
Default: "user",
@ -153,6 +154,7 @@ func init() {
}
func refreshJWTToken(jsonFile string, boxSubType string, name string, m configmap.Mapper) error {
jsonFile = env.ShellExpand(jsonFile)
boxConfig, err := getBoxConfig(jsonFile)
if err != nil {
log.Fatalf("Failed to configure token: %v", err)