rclone/fs/config
Nick Craig-Wood 874d66658e fs: fix setting stringArray config values from environment variables
After the config re-organisation, the setting of stringArray config
values (eg `--exclude` set with `RCLONE_EXCLUDE`) was broken and gave
a message like this for `RCLONE_EXCLUDE=*.jpg`:

    Failed to load "filter" default values: failed to initialise "filter" options:
    couldn't parse config item "exclude" = "*.jpg" as []string: parsing "*.jpg" as []string failed:
    invalid character '/' looking for beginning of value

This was caused by the parser trying to parse the input string as a
JSON value.

When the config was re-organised it was thought that the internal
representation of stringArray values was not important as it was never
visible externally, however this turned out not to be true.

A defined representation was chosen - a comma separated string and
this was documented and tests were introduced in this patch.

This potentially introduces a very small backwards incompatibility. In
rclone v1.67.0

    RCLONE_EXCLUDE=a,b

Would be interpreted as

    --exclude "a,b"

Whereas this new code will interpret it as

    --exclude "a" --exclude "b"

The benefit of being able to set multiple values with an environment
variable was deemed to outweigh the very small backwards compatibility
risk.

If a value with a `,` is needed, then use CSV escaping, eg

    RCLONE_EXCLUDE="a,b"

(Note this needs to have the quotes in so at the unix shell that would be

    RCLONE_EXCLUDE='"a,b"'

Fixes #8063
2024-09-13 15:52:51 +01:00
..
configfile docs: fix some function names in comments 2024-09-02 18:20:08 +02:00
configflags build: update logging statements to make json log work - fixes #6038 2024-09-06 17:04:18 +01:00
configmap all: fix spelling across the project 2022-08-30 11:16:26 +02:00
configstruct fs: fix setting stringArray config values from environment variables 2024-09-13 15:52:51 +01:00
flags fs: fix setting stringArray config values from environment variables 2024-09-13 15:52:51 +01:00
obscure build: update logging statements to make json log work - fixes #6038 2024-09-06 17:04:18 +01:00
testdata Convert source files with crlf to lf 2024-04-18 11:32:45 +02:00
authorize.go fs: refactor fs.ConfigMap to take a prefix and Options rather than an fs.RegInfo 2024-07-15 11:09:53 +01:00
config_read_password_unsupported.go build: remove build constraint syntax for go 1.16 and older 2024-04-18 16:53:55 +02:00
config_read_password.go build: update logging statements to make json log work - fixes #6038 2024-09-06 17:04:18 +01:00
config_test.go config: use --password-command to set config file password if supplied 2024-09-06 10:34:29 +01:00
config.go build: update logging statements to make json log work - fixes #6038 2024-09-06 17:04:18 +01:00
crypt_internal_test.go config encryption: set, remove and check to manage config file encryption #7859 2024-09-06 10:34:29 +01:00
crypt_test.go config encryption: set, remove and check to manage config file encryption #7859 2024-09-06 10:34:29 +01:00
crypt.go config encryption: set, remove and check to manage config file encryption #7859 2024-09-06 10:34:29 +01:00
default_storage_test.go config: replace defaultConfig with a thread-safe in-memory implementation 2021-05-07 16:04:09 +01:00
default_storage.go config: replace defaultConfig with a thread-safe in-memory implementation 2021-05-07 16:04:09 +01:00
rc_test.go config: make getting config values more consistent 2024-08-08 13:41:31 +01:00
rc.go config: make listing of remotes more consistent 2024-08-08 13:41:31 +01:00
ui_test.go build: fix gocritic lint issue assignop 2024-08-15 22:08:34 +01:00
ui.go build: update logging statements to make json log work - fixes #6038 2024-09-06 17:04:18 +01:00