You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow several properties that match a given pattern to be expanded as a token separator list.
Goals
Allow components of a list to have a name in the environment properties file.
Maybe: enable the gathering of shared subcomponent properties in a list, so if we need to reference all properties in the form xxx.*.yyy we do not need to define an extra property for that.
Possible side effect: let different files inject additional values to a token separated list.
We could discuss the semantics later, but for now, consider this use case, you have a SelectDestination participant, and there you have many bins for the same destination, let's say Visa o Mastercard networks.
You could, of course, have a line like this in your yaml:
Or things like that.
But if you want to have "pluggable" elements, like adding an extra bin for dev testing in a separate env file, or simply having to type less, you could have:
And you can add more bins in other files, not that I can think of a use case for bins, but maybe for other things.
The implementation would be pretty straight forward (but not performant unless we cache the expanded values), like just filter the property keys by prefix.
We can even have an optional extra character (or string) for the separator.
Alternatives
I can think of implementing this as a custom EnvironmentProvider that could be enabled if some system property is missing, maybe we could talk in another discussion about a standard way to define feature flags, or preview features.
There are also different ways to implement the semantic, there are at least three basic options for the * semantics, that could easily expand to more:
Just to define a prefix, and all include all the flattened properties that just start with what comes before the *. This would be the simplest to implement, and the most general, but probably the trickiest to use.
Only consider it if it is after a dot and then, again, as a simple prefix.
Same as 2, but only consider properties that have no dots after. This would be like the java wildcard imports.
There could be a variant of all of them where you could put as many * like in a glob pattern in a shell. This could be useful for things like referencing all the yyy properties. We could even implement modifiers to let the user state the meaning.
The implementation is quite simple, and the environment could just cache the property as a property that has the key xxx.yyy.*. If it is present that is used, if not, it is calculated and saved.
The useful thing about the variant, is that then you can have ${xxx.} in one place and ${.yyy} in another. Allowing you to not having to define new properties if in some place you need, for instance, all the bins, again a bad example since I don't know if there could be a legit use case for that.
Risks and assumptions
This can be tricky with circular dependencies, so we need to consider how to handle them, e.g.:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
Allow several properties that match a given pattern to be expanded as a token separator list.
Goals
xxx.*.yyy
we do not need to define an extra property for that.Description
Pasted from a Slack message so it doesn't get lost
We could discuss the semantics later, but for now, consider this use case, you have a
SelectDestination
participant, and there you have many bins for the same destination, let's say Visa o Mastercard networks.You could, of course, have a line like this in your yaml:
And in the routes:
If you want to have more descriptive names for your elements, you could even do this:
Or things like that.
But if you want to have "pluggable" elements, like adding an extra bin for dev testing in a separate env file, or simply having to type less, you could have:
And in the routes:
And you can add more bins in other files, not that I can think of a use case for bins, but maybe for other things.
The implementation would be pretty straight forward (but not performant unless we cache the expanded values), like just filter the property keys by prefix.
We can even have an optional extra character (or string) for the separator.
Alternatives
I can think of implementing this as a custom
EnvironmentProvider
that could be enabled if some system property is missing, maybe we could talk in another discussion about a standard way to define feature flags, or preview features.There are also different ways to implement the semantic, there are at least three basic options for the
*
semantics, that could easily expand to more:There could be a variant of all of them where you could put as many
*
like in a glob pattern in a shell. This could be useful for things like referencing all theyyy
properties. We could even implement modifiers to let the user state the meaning.The implementation is quite simple, and the environment could just cache the property as a property that has the key
xxx.yyy.*
. If it is present that is used, if not, it is calculated and saved.The useful thing about the variant, is that then you can have ${xxx.} in one place and ${.yyy} in another. Allowing you to not having to define new properties if in some place you need, for instance, all the bins, again a bad example since I don't know if there could be a legit use case for that.
Risks and assumptions
This can be tricky with circular dependencies, so we need to consider how to handle them, e.g.:
Beta Was this translation helpful? Give feedback.
All reactions