Add authentication to the ntfy hook #644
No reviewers
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#644
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Tom-Hubrecht/borgmatic:ntfy-auth"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds basic auth to the ntfy hook.
Closes #621
a79c0b8441
tod80e716822
This looks great! Thanks so much for taking the time to implement it. Would you also mind adding relevant unit tests as appropriate? The ntfy test file is at
tests/unit/hooks/test_ntfy.py
and you can read about running borgmatic tests here: https://torsion.org/borgmatic/docs/how-to/develop-on-borgmatic/#automated-tests@ -59,0 +61,4 @@
auth = (
requests.auth.HTTPBasicAuth(username, password)
if (username and password) is not None
This logic looks completely correct, but it was initially confusing for me. Not a big deal, just letting you know in case you want to clarify it.
I made it explicit
1c7ad67c8c
to95575c3450
Thanks so much for adding tests!
@ -59,0 +67,4 @@
logger.warn(
f'{config_filename}: Password missing for Ntfy authentication, defaulting to no auth'
)
elif password is not None:
I like that you've split this out with warnings. But this logic might be a little more intuitive if it was something like:
Although I will say that the way you did it has the distinct benefit of skipping the warning if both username and password are missing!
Thanks again!
Just released in borgmatic 1.7.8!