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

prompt for password if none is given #61

Merged
merged 2 commits into from
Aug 1, 2024
Merged

prompt for password if none is given #61

merged 2 commits into from
Aug 1, 2024

Conversation

rluetzner
Copy link
Contributor

This shows a password prompt, if neither the --password-file or --password-command option is given and the RESTIC_PASSWORD env variable is unset.

There's no way to hand over the password to restic as a CLI parameter, so we use the RESTIC_PASSWORD env variable under the hood to set it instead. The env variable is only valid for the restic process we call internally, so the next time redu is run, it'll prompt for the password again.

This fixes #27 .

Copy link
Contributor Author

@rluetzner rluetzner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I'm reeeeeeeally new to Rust (apart from the changes yesterday, this is my first time working with Rust), I have a few questions and comments already.

Cargo.toml Show resolved Hide resolved
src/args.rs Outdated Show resolved Hide resolved
src/args.rs Outdated Show resolved Hide resolved
src/args.rs Show resolved Hide resolved
src/args.rs Outdated Show resolved Hide resolved
This shows a password prompt, if neither the `--password-file` or
`--password-command` option is given **and** the `RESTIC_PASSWORD` env
variable is unset.

There's no way to hand over the password to restic as a CLI parameter,
so we use the `RESTIC_PASSWORD` env variable under the hood to set it
instead. The env variable is only valid for the restic process we call
internally, so the next time redu is run, it'll prompt for the password
again.
@rluetzner
Copy link
Contributor Author

Tested the new code and cmd.env() works as expected. 🙂

@drdo
Copy link
Owner

drdo commented Aug 1, 2024

Great job! LGTM

@drdo drdo merged commit 761e8e3 into drdo:main Aug 1, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prompt for password and/or repository if they are not provided via restic env vars or redu cmd line arguments
2 participants