mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
config: support hyphen in remote name from environment variable
This commit is contained in:
@@ -237,11 +237,11 @@ func AddConfig(ctx context.Context) (context.Context, *ConfigInfo) {
|
||||
return newCtx, cCopy
|
||||
}
|
||||
|
||||
// ConfigToEnv converts a config section and name, e.g. ("myremote",
|
||||
// ConfigToEnv converts a config section and name, e.g. ("my-remote",
|
||||
// "ignore-size") into an environment name
|
||||
// "RCLONE_CONFIG_MYREMOTE_IGNORE_SIZE"
|
||||
// "RCLONE_CONFIG_MY-REMOTE_IGNORE_SIZE"
|
||||
func ConfigToEnv(section, name string) string {
|
||||
return "RCLONE_CONFIG_" + strings.ToUpper(strings.Replace(section+"_"+name, "-", "_", -1))
|
||||
return "RCLONE_CONFIG_" + strings.ToUpper(section+"_"+strings.Replace(name, "-", "_", -1))
|
||||
}
|
||||
|
||||
// OptionToEnv converts an option name, e.g. "ignore-size" into an
|
||||
|
||||
Reference in New Issue
Block a user