I think the development of Grin is at a point where it could use a proper configuration file. I want to start adding parameters here and there while working on the mining integration, and the command line switches are getting a bit cumbersome.
I don't think this is much more than an evening's work, but before barging ahead I think it's worth a little bit of discussion as to what format it should take.
The main contenders I can see are:
-.ini
-YAML
-JSON
-TOML
None of these is really 'native' to Rust, (like how it makes most sense to use json in a pure javascript project) with the exception of TOML. Ini files keep it simple, but can be a bit limited... YAML gives the most flexibility, but I personally don't like whitespace having meaning. JSON gives a good degree of flexibility, but it looks like code and you have to be mindful of parenthesis and the structure when making edits, which could be annoying for non-technical users.
Perhaps TOML might make sense as a good balance here, being more readable than JSON or YAML but more flexible than ini files?
Originally I as going to do JSON, as we already have Serialize and Deserialize implementations for the config structs and already use the serde JSON library. But I'm totally open to TOML as well as long as we don't need to add yet another serialization tool. And it looks like serde has a TOML encoding (https://github.com/alexcrichton/toml-rs so that could work.
Okay, I'll give TOML a try first and try and structure the config in such a way as it can be replaced easily enough if it doesn't work out.
.toml without nesting seems very user friendly. More so than .ini, much more than .json. And YAML has a lot more magic that can confuse people.
I actually think toml without nesting is the best option, with the lowest risk of user confution and added "support cases" to get users up and running.
So, maybe close this issue?
Most helpful comment
Okay, I'll give TOML a try first and try and structure the config in such a way as it can be replaced easily enough if it doesn't work out.