WIP: Optional values "the other way" and replace peer with peers #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
This commit is based on top of #15, I do not think this PR should be merged as-is, this is a breaking change that would break peoples installations. It implements the discussion in #14 and re-implements #15 in another way.
Peers
If you like to go forward with this, or something similar I think we need to do one of 3 things:
a) Make it a breaking change, clearly communicate this to the users, or
b) Make some form of migration script that rewrites the configuration to the new format, or
c) Support both
peer
andpeers
I initially tried to implement c, but it quickly got messy. I considered b as a better solution. In this PR i just did a :)
This is exactly the same syntax, just a list of possible multiple peers. You can inspect the commit that adds this functionality here: nsg@698b4d3
A few notes:
bashio::jq
is a stable API to use nsg@698b4d3#diff-f5eeb82cf2a7d038d1baaace560daa12ee3d2ded417fc0f2d6d45278566ab68dR122 .. I found no other nice way to access the data from the loop otherwise.Optional values "the other way"
This is the alternative implementation of #15, instead of messing with empty variables this just makes the values optional via the built in functionality. This feels more like "The Home Assistant Way" but has the disadvantage that we wont get a nice sample configuration generated on first install. This change should be backward compatible.
See the commit here: nsg@414f2f9
To summarize
Feel free to close this, see this more as a PR with code samples and ideas ... I think nsg@414f2f9 could be an interesting alternative to #15 for example. If you feel you like to move forward with the idea of supporting multiple peers I would love to discuss what you think about the options a, b or c.
Oh, this code is not that well tested, it runs (for me) 😁
Related Issues / PRs