Skip to content

Commit

Permalink
warn: warn about RUSTIC_APP.config() vs self usage
Browse files Browse the repository at this point in the history
In commands that have configurations from
the ENV and the TOML (on top of CLI),
a confusion between RUSTIC_APP.config()
and &self (see `inner_run` impls) could
lead to parts of the user configured options
to be ignored.

For now we warn about this in the code.
But some design change should be decided
in order to avoid these risks in the future.
  • Loading branch information
nardoor committed Sep 17, 2024
1 parent 6134e93 commit 60f7ec9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/commands/forget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ impl Runnable for ForgetCmd {
}

impl ForgetCmd {
/// be careful about self VS RUSTIC_APP.config() usage
/// only the RUSTIC_APP.config() involves the TOML and ENV merged configurations
/// see https://github.com/rustic-rs/rustic/issues/1242
fn inner_run(&self) -> Result<()> {
let config = RUSTIC_APP.config();
let repo = open_repository(&config.repository)?;
Expand Down
3 changes: 3 additions & 0 deletions src/commands/webdav.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ impl Runnable for WebDavCmd {
}

impl WebDavCmd {
/// be careful about self VS RUSTIC_APP.config() usage
/// only the RUSTIC_APP.config() involves the TOML and ENV merged configurations
/// see https://github.com/rustic-rs/rustic/issues/1242
fn inner_run(&self) -> Result<()> {
let config = RUSTIC_APP.config();
let repo = open_repository_indexed(&config.repository)?;
Expand Down

0 comments on commit 60f7ec9

Please sign in to comment.