mqtt-tools / mqttwarn

A highly configurable MQTT message router, where the routing targets are notification plugins, primarily written in Python.
https://mqttwarn.readthedocs.io/
Eclipse Public License 2.0
950 stars 183 forks source link

Add configuration variable expansion #681

Closed jhakonen closed 11 months ago

jhakonen commented 11 months ago

This PR implements issue #560.

I went with the variable pattern of ${ENV:NAME} or $ENV:NAME as suggested by jpmens. Including also support for loading file content with ${FILE:file/path}. I used FILE instead of FS as I think it is more explicit.

I didn't add support for HashiCorp's Vault as I don't have personal experience of using it, but provided that there's a way to fetch vault's value then it is easy to add support for it by modifying VariableInterpolation.sources.

codecov[bot] commented 11 months ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.45 :tada:

Comparison is base (29ea2f5) 48.88% compared to head (b5d3b3b) 49.33%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #681 +/- ## ========================================== + Coverage 48.88% 49.33% +0.45% ========================================== Files 81 81 Lines 3938 3973 +35 ========================================== + Hits 1925 1960 +35 Misses 2013 2013 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `49.33% <100.00%> (+0.45%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mqtt-tools#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/mqtt-tools/mqttwarn/pull/681?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mqtt-tools) | Coverage Δ | | |---|---|---| | [mqttwarn/configuration.py](https://app.codecov.io/gh/mqtt-tools/mqttwarn/pull/681?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mqtt-tools#diff-bXF0dHdhcm4vY29uZmlndXJhdGlvbi5weQ==) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

amotl commented 11 months ago

Thank you very much, Janne! 💯