Let's say I have a config file on the server-side of a Node.js app:
config.litcoffee:
# Config
This configures stuff, and allows comments on whatever.
privateFoo = 'privateBar'
## Public ##
module.exports =
Setting `foo` equal to `bar` does this and that.
foo: 'bar'
Now, somewhere else I want to update the config.litcoffee file, allowing comments in the future (if warranted), and preserving old ones:
whatever.litcoffee:
# Some application feature
config = require './config'
fs = require 'fs'
config.baz = 'bunk'
fs.writeFileSync './config.litcoffee', config, ...
...which obviously doesn't work.
I see that I can use the coffee command to get tokens and such, but it seems like a lot of work to rebuild those and "splice" the new baz parameter in. Has anyone done this? I'd rather not use straight JSON, as I shouldn't have to have a separate README for the configuration.