rbenv-vars, environment config file and Paperclip

347 Views Asked by At

I have an application running in Ruby on Rails. I use rbenv-vars to manage the environment variables used by the app and some of those variables are used in the environment config file to initialize AWS S3 storage setup in Paperclip's paperclip_defaults hash. However, recently I have updated the value of a S3-related variable in the .rbenv-vars file, restarted the application and Paperclip is always configured with the old (wrong) S3-related variable value. Oddly, the environment variable has the correct value (checked debugging the app and also using rails console) after Ruby environment startup. I temporarily fixed the issue by setting the variable AGAIN in ~/.bash_profile.

Has anyone ever experienced this? Any suggestions are welcome.

1

There are 1 best solutions below

0
On

I suggest you to used Dot ENV GEM

By using the Gem you can define the ENV variables at system level. If you are doing any changes related to configuration in rails application. You need to restart your application.