Skip to content
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

Allow to override an array field / nested property #358

Open
sschuberth opened this issue Mar 3, 2023 · 8 comments
Open

Allow to override an array field / nested property #358

sschuberth opened this issue Mar 3, 2023 · 8 comments

Comments

@sschuberth
Copy link
Contributor

          > I guess we could support `databases[1]__port = 9301` ?

I'd still be interested to override single properties within a list of a config read from a file via CLI options like that, without the need to declare "placeholder properties" that refer to environment variables. Is something like that supported by now?

Originally posted by @sschuberth in #144 (comment)

@sschuberth
Copy link
Contributor Author

sschuberth commented Mar 3, 2023

More specifically, it would be great if MapPropertySource and CommandLinePropertySource would support the "key" to contain an index like [1] to be able to override single values nested within an array list. (Even is that value was not present originally, so it's more "add" than "override"; in that aspect this issue is different from #144, where you can work with environment placeholders.)

@sschuberth
Copy link
Contributor Author

@sksamuel I'm willing to work on this, but I have no clue where to start. Is my approach outlined above even feasible to implement?

@sksamuel
Copy link
Owner

I think your approach for map property source and cli property source are perfectly reasonable.
We already do something some what similar in the aws preprocessor with [] used for json fields.

@stale
Copy link

stale bot commented Aug 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 12, 2023
@sschuberth
Copy link
Contributor Author

While I didn't have time to work on this yet, I believe it still makes sense as a feature to add.

@stale stale bot removed the wontfix This will not be worked on label Aug 17, 2023
@sschuberth
Copy link
Contributor Author

aws preprocessor with [] used for json fields.

Maybe by now https://github.com/eygraber/JsonPathKt could be leveraged...

@sksamuel
Copy link
Owner

Not sure we even need that. Just need to take [n] and apply that to the list ?

@sschuberth
Copy link
Contributor Author

Not sure we even need that. Just need to take [n] and apply that to the list ?

For lists you're probably right. But we basically have the same issue also for overriding values in a map. And there, in order to refer to the key's name in the map, maybe JsonPathKt would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants