title: Rails - Mina - not able to load environment variables in database.yml file
body: <p>Mina is not able to load environment variables which are in database.yml file as mentioned below:</p>
  
  <p><strong>deploy.rb:</strong></p>
  
  <pre><code>task :deploy =&gt; :environment do
    deploy do
      # Put things that will set up an empty directory into a fully set-up
      # instance of your project.
      invoke :'git:clone'
      invoke :'deploy:link_shared_paths'
      invoke :'bundle:install'
      invoke :'rails:db_migrate'
      queue! "#{rake} db:seed"
      invoke :'rails:assets_precompile'
      invoke :'deploy:cleanup'
    end
  end
  </code></pre>
  
  <p><strong>vim ~/.bash_profile :</strong></p>
  
  <pre><code>export MYSQLUSERNAME=mysql_user_name
  export MYSQLPASSWORD=mysql_password
  </code></pre>
  
  <p><strong>database.yml:</strong></p>
  
  <pre><code>production:
    adapter: mysql2
    encoding: utf8
    reconnect: false
    database: my_db_name
    pool: 5
    username: &lt;%= ENV['MYSQLUSERNAME'] %&gt;
    password: &lt;%= ENV['MYSQLPASSWORD'] %&gt;
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>$ mina deploy
    .....
    .......
    -----&gt; DB migrations unchanged; skipping DB migration
           $ RAILS_ENV="production" bundle exec rake db:seed
           rake aborted!
           Mysql2::Error: Access denied for user 'root'@'localhost' (using password: NO)
                 /home/user_name/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `connect'
  </code></pre>
  
  <p><strong>Note:</strong> If i replace username(mysql_user_name) and password(mysql_user_name) values instead of &lt;%= ENV['MYSQLUSERNAME'] %> and &lt;%= ENV['MYSQLPASSWORD'] %> in database.yml file, it works well.</p>
  
  <p>Can anyone please help me that how i can load ENV variables in *.yml file while deploying using Mina.</p>
  
  <p>Thanks!</p>