4 ms·
That's a great idea to include default configuration as a file instead of coded values!
by jlelse 6y ago
That's a great idea to include default configuration as a file instead of coded values!
- latchkey 6y agoThanks! Yea, I built a whole kind of config api for another project a long time ago and used this technique. It worked well. That said, I went a bit overboard on it because I wanted to load a json file as the 'default' base and then be able to save it on the filesystem, update it via a http API and merge in changes over time to the saved version on disk. The reason was that this 'agent' ran on thousands of little computers (litecoin mining machines) and needed to be configurable per miner. This is the source if you want to take a look: https://github.com/blockassets/bam_agent/blob/master/service/agent/config.go https://github.com/blockassets/bam_agent/blob/master/service... It is all unit tested too. For another more recent project that isn't open source, I've since re-done it to be a lot simpler (and moved to packr2). It just reads the file. =)
- deleted 6y ago[deleted]