I have a local development machine and a test server.
With gulp it’s possible to add a flag on the command line:
gulp build --env=production
That way I can get the correct APP_ID from a file.
The only issue is with this approach I need to run my build on the server, at this moment I run gulp locally and upload the changes to my server
For more info on how to use env variable in node (gulp run over node) see this page
For example in linux you can set env variable with export
> export foo=app1 > node app.js
> export foo=app2 > node app.js
This is valid only if you run your code server side on node (ex on gulp).
If you are developing a client side library and you want to create different builds that targets different enviroments you have to instruct gulp to do so. In this case this is a guide that can help you