Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variables in the config files not supported #942

Open
kuyagic opened this issue Nov 15, 2023 · 4 comments
Open

Environment variables in the config files not supported #942

kuyagic opened this issue Nov 15, 2023 · 4 comments
Labels
A-config Area: Related to the config file functionality and format C-enhancement Category: New feature or request

Comments

@kuyagic
Copy link

kuyagic commented Nov 15, 2023

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

@github-actions github-actions bot added the S-triage Status: Waiting for a maintainer to triage this issue/PR label Nov 15, 2023
@simonsan simonsan added C-bug Category: Something isn't working as expected O-windows Operating system: Windows A-config Area: Related to the config file functionality and format and removed S-triage Status: Waiting for a maintainer to triage this issue/PR labels Nov 15, 2023
@aawsome aawsome added C-enhancement Category: New feature or request and removed C-bug Category: Something isn't working as expected O-windows Operating system: Windows labels Jan 11, 2024
@aawsome
Copy link
Member

aawsome commented Jan 11, 2024

I marked this as enhancement wish as currently there is no substitution of variables in the config file. See also #996

@aawsome aawsome changed the title Environment variables in the config files not working on windows Environment variables in the config files not supported Jan 11, 2024
@aawsome
Copy link
Member

aawsome commented Jan 11, 2024

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)?

@simonsan
Copy link
Contributor

simonsan commented Feb 9, 2024

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.

@aawsome
Copy link
Member

aawsome commented Feb 19, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-config Area: Related to the config file functionality and format C-enhancement Category: New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants