essentially, we want to keep a set of constants to be used across the rails app and javascript code. For example:
{A:3
B:4
C:5}
We try not to embed rails code in javascript, and we do not want 2 copies of constants.
Thanks!
Keeping Environment Variables PrivateRemote git repositories such as GitHub are a place to store and share code. If your project is open source, any developer will have access to your code. You don't want to share email account credentials or private API keys with the public.
The Global environment variables of your system are stored in /etc/environment . Any changes here will get reflected throughout the system and will affect all users of the system. Also, you need a Reboot, for any changes made here to take effect.
You store separate environment variables in config/development. rb , config/testing. rb and config/production. rb respectively.
put it in JSON file and parse it in your ruby file and same in your javascript file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With