-
Notifications
You must be signed in to change notification settings - Fork 184
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
Proposal: Named parameters for target address descriptor configurations #628
Comments
Hi again,
Let me reference both patches as examples which demonstrate the corresponding improvement for the Pushsafer service configuration, while retaining compatibility with the previous configuration layout. With kind regards, |
Hi again, at #632 (comment), we reported about improvements to the Frigate » Forward events and snapshots to ntfy integration tutorial. This also utilizes the improved way of defining named parameters within target address descriptors. I think it works very well, and I haven't heard about any compatibility problems yet. [config:ntfy]
targets = {
'test': {
'url': 'http://username:password@localhost:5555/frigate-testdrive',
'file': '/tmp/mqttwarn-frigate-{camera}-{label}.png',
'click': 'https://httpbin.org/anything?camera={event.camera}&label={event.label}&zone={event.entered_zones[0]}',
# Wait for the file to arrive for three quarters of a second, and delete it after reading.
'__settings__': {
'file_retry_tries': 10,
'file_retry_interval': 0.075,
'file_unlink': True,
}
}
} With kind regards, |
With GH-676, the Pushbullet service plugin now also uses the modernized variant, based on named parameters. [config:pushbullet]
targets = {
"warnme" : {
"access_token": "a6FJVAA0LVJKrT8k",
"recipient": "[email protected]",
"recipient_type": "email",
},
"alertme" : {
"access_token": "a6FJVAA0LVJKrT8k",
"recipient": "ujpah72o0sjAoRtnM0jc",
},
} |
Dear JP and Ben,
while modernizing mqttwarn on some aspects after taking over maintenance, I regularily touch the important detail about the configuration of the plugin service target address descriptors, originally designed to be a
list
, mostly. I believe it may be confusing for service plugins which would better need to obtain named parameters instead.In order to improve this situation, I would like to make a general proposal. Please let me know if you have any objections.
With kind regards,
Andreas.
Status quo
For the SMTP service, this is just perfect.
At the Pushover configuration snippet, for example, it is tolerable.
Problem
On the other hand, this style of configuration is clearly confusing with the Pushsafer plugin, where you would have to constantly maintain a mind map of parameter positions within the list, in order to reason about their meanings. This does not only happen to the user, but also to the maintainer of this plugin.
Proposal
So, my proposal is to use dictionaries instead, where it makes sense to propagate named parameters to service plugins, similarly to how it has been implemented for the Apprise service plugin already, see GH-558 and GH-627.
Of course, backward compatibility should and will be maintained when applying this improvement to any of the existing service plugin configurations 1.
Example for Apprise
Example for Pushsafer
Footnotes
I am looking at Pushsafer here, see [Pushsafer] Improve configuration to use named parameters #629. ↩
The text was updated successfully, but these errors were encountered: