rustic
rustic copied to clipboard
Environment variables in the config files not supported
Environment variables in the config files is not properly expanded on windows I set the following
[backup]
exclude-if-present = [".nobackup", "CACHEDIR.TAG"]
iglob-file = ["C:/ProgramData/rustic/ignore.iglob.list"]
this is working.
but both %PROGRAMDATA%/rustic/ignore.iglob.list
and %PROGRAMDATA%\\rustic\\ignore.iglob.list
not working.
Variables are not expanded. This affects both Windows and *Unix
I marked this as enhancement wish as currently there is no substitution of variables in the config file. See also #996
This feature is a bit more involved as there are more questions arising:
- Do we only want variable substitution in filenames or elsewhere in the config?
- Do we want to allow substition only within strings?
- Do we want to first parse the TOML, then substitute what is appropriate or first substitute and then parse (which would allow to define TOML structures within env variables)?
There is this library https://crates.io/crates/expand_str, which is an alternative to https://docs.rs/crate/shellexpand/3.1.0 which is useful for tilde expansion.
I would suggest to start with expanding env variables where shellexpand
is also a good candidate. I would actually keep it really simple and just expand everything before we parse the toml.
There is the rustic show-config
command which is able to show which config rustic is using, so enough possibility for users to debug any strange behavior.