Search code examples
ruby-on-railsubunturuby-on-rails-5

How to set environment variable inside ubuntu so that they can be access by the nginx, sidekiq and rails application


How to set environment variable in side ubuntu so that they can be access by the nginx, sidekiq and rails application both in development and production environment.


Solution

  • There could be multiple ways but one possible approach is:

    set environment variable in the /etc/environment file:

    sudo vim /etc/environment
    

    Now set values as:

    APP_URL="http://lcoalhost:3000"
    APP_HOST="127.0.0.1"
    EMAIL_HOST="127.0.0.1"