DRY up ENV logic

These commits DRY up the environment logic to simplify maintenance and make sure all parts of application_procfile are using the same environment logic.