dimanche 29 mai 2016

Delay evaluation of .js.erb to server while precompiling assets on development machine

I have an app which uses an API key for a particular API. The API has both test and live keys, and I want the key to be configurable. I'm using the key in a .js file, so I made it into a .js.erb file and added <%= ENV[API_KEY] %> to set it from the environment variable (which is set appropriately for test or live). However, since I pre-compile the assets on my development machine, I'm getting the test key in production, even though I've got the live key defined on the production machine. I don't see a way around this issue. Is there a different best practice for accomplishing this?

Aucun commentaire:

Enregistrer un commentaire