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
I have an application with a default set of options and another set of options to override the default (either the subset or its entirety ) . How do pass 2 .toml in a specific order so I get a final object that represents the merged / overridden values.
Eg: the go implementation takes in an object and 'decodes' a given toml on that object. This helps us to have a simpler override functionality. More details at https://godoc.org/github.com/BurntSushi/toml#Decode .
Is there a similar api / hack available to repeatedly parse and process a bunch of .toml files so we can override default options ?
The text was updated successfully, but these errors were encountered:
@akkumar So the result of TOML.parse is just a JS object, so the usual approach would be to combine them with JS tools. Exactly what that looks like depends on your needs:
So you might go with the most simple option, with object composition:
Something that might be cool would be a config library built on top of this library that provides composition of objects like this. Maybe something like rc but built on TOML instead of ini files.
I have an application with a default set of options and another set of options to override the default (either the subset or its entirety ) . How do pass 2 .toml in a specific order so I get a final object that represents the merged / overridden values.
Eg:
Eg: default.toml
Eg: prod.toml
So hypothetically an api like -
would yield a final toml object as below:
Eg: the go implementation takes in an object and 'decodes' a given toml on that object. This helps us to have a simpler override functionality. More details at https://godoc.org/github.com/BurntSushi/toml#Decode .
Is there a similar api / hack available to repeatedly parse and process a bunch of .toml files so we can override default options ?
The text was updated successfully, but these errors were encountered: