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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this also an array of
Numeric
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ekohl I think that
Array[String[1]]
is suitable in the case of passing config values for listen_addresses (i understand value is used in numerous cases, but we are still trying to keep some form of security on what is passed), curious on your thoughts of updating this to acceptArray[Numeric]
values as well.I think continuing to update this is a bit out of scope, as initially this was implemented as a quick bug fix to ensure that existing manifests with values for
listen_addresses
did not break after the syntax update carried out on this module. but I'm open to your suggestions. 💯There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably fine, since I don't know how many array values there are where it is numeric. You can indeed use the following in YAML as a workaround:
But very often you see some consistency, like
Variant[X, Y, Array[Variant[X, Y]]]
so that's something that always goes through my head. Still, it's not always true. For example, the current type can be written asVariant[Undef, String[1], Numeric, Array[String[1]]]
(which is actually shorter thanOptional[]
) and you don't want to acceptArray[Undef]
.That's at least how I look at these data types and assess if it fits what's needed.
The config entry is supposed to reflect a setting, so https://www.postgresql.org/docs/current/config-setting.html is a good resource. That states:
So String and Numeric certainly are good. Enum is covered by String. Then for booleans there's:
So accepting
Boolean
is also good.There's no real array type, but there are types which are lists. https://www.postgresql.org/docs/current/runtime-config.html is quite long. Most are comma joined with
ssl_ciphers
as an exception. We can ignore that one and require the user to specify it as a single string.In conclusion: I think the current type will work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ekohl as always, thanks for your great work and investigation into keeping our modules in top condition, it is appreciated!!
Completely understand your reasoning now thanks to all that info, I'll add a ticket to our backlog to further investigate this and implement it if required/we think it will be nice (which I must admit I do now..).
So thanks again 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking further on this, you could apply even stricter validations. Completely untested, but something that might work:
That doesn't require you to specify all possible config entries, but for some you can have stricter validation preventing misconfigurations.
You may also be able to write it as a
Struct
type, but I think that would get awkward. Benefit would be better visibility inREFERENCE.md
so something to think about.