A Script to Update Riak Config Files

Yesterday, one of my teammates who does a lot of work in automating our deployments came to me and asked me for some in parsing and updating a JSON config file so that he could automate the setting of configuration data during automated deployments.  I took one look at the config file in front of me and said “Bro, that’s not JSON.  Those are Erlang terms.”

He was working on automting the Riak deployment we are setting up for some new features.  He had never touched erlang (or any functional language) so i offered to show him the ropes and write a script that could read and update Riak app.config. I figured i would post it here for a couple of reasons:

  • I’m no Erlang expert myself.  I’d love to get feedback on easier/better ways to accomplish this
  • Somebody else probably wants to solve this problem and the script may help.
So here it is, enjoy!