Unable to Access ENV variable in rails
<p>I am trying to use env variables in my rails app and set those variable values in <strong>ubuntu 14.04</strong></p>

<p>I tried setting using export command</p>

<pre><code>export mongodb_username="abc"
export mongodb_password="cde"
</code></pre>

<p>and also tried setting them in <strong>/etc/environment</strong> and in <strong>~/.bashsrc</strong></p>

<p>and <strong>printenv</strong> gives following results</p>

<pre><code>   &gt;&gt; printenv mongodb_username
   =&gt; abc
   &gt;&gt; printenv mongodb_password
   =&gt; cde
</code></pre>

<p>BUT in <strong>RAILS APP</strong> or <strong>irb</strong> the output is following</p>

<pre><code>&gt;&gt; ENV['mongodb_password']
=&gt; nil
&gt;&gt; ENV['mongodb_username']
=&gt; nil
</code></pre>

<p>I am missing something? Please help!!!</p>