-
Notifications
You must be signed in to change notification settings - Fork 0
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
Iterating over keys / values or serializing flattened view #81
Comments
Hm yes, I think that should be possible in general, but I don't quite understand the usecase for it... could you elaborate? |
One use case I have is hooking up a layered config system with a template layer, e.g. Tera or Liquid. Those template systems usually require some context structure that contains all the values to be injected. Another use case would be to render the flattened configuration to some serializeable format, e.g. JSON to be consumed by another application. |
I don't understand why you would need to iterate over the individual layers for this?
Serializing to a serde-compatible format is one of the things that has to be included in config-rs-ng! |
I would not have to iterate over individual layers but over keys in the combined view. The problem is the a priori knowledge of the key names. Basically, I need to be able to put the results of the config into e.g. a |
Ah, yes... so that would mean you have some kind of |
Not sure what you mean by |
No, that would be included in config-rs-ng: let json = Config::builder()
.load(/* something */)
.build()
.unwrap()
.serialize_to::<serde_json::Value>()
.unwrap() The above is pseudo-code, the interface may look completely different, but I think it shows what I mean: Loading different configurations into a layered object and then serializing that to some custom format (whereas "custom" can also be |
I'm not sure how this would work with accessors, but I'm looking for an implementation that would allow me to get a flattened "view" of layered configuration with the ability to iterate over all config variables in each layer. Is there any chance this could fit into config-rs-ng's vision?
The text was updated successfully, but these errors were encountered: