I do this using a gulp task I created and run it manually in the command line before I do a build.
For example, I run my command:
gulp replace --app app1
Which then reads the config.json file I made and replaces all the placeholder variables in my config_before.xml and outputs a new file, config.xml, with all the correct configuration.