I am trying to back up a database as part of the deployment of a Capistrano (v3) script (for a NON-Rails application).
The script works fine - if I configure the hardcode database.
Now I want to load the database configuration from the .env file. On my local machine, my .env file (in the root of the repo next to the Capfile) looks like this:
DB_NAME='local_name'
DB_USER='local_user'
DB_PASSWORD='local_pw'
DB_HOST='127.0.0.1'
On the server, the .env file (which Capistrano placed in the folder sharedand marked in the folder current) looks like this:
DB_NAME='dev_name'
DB_USER='dev_user'
DB_PASSWORD='dev_pw'
DB_HOST='127.0.0.1'
However, when I start deploying the cover, I get the following:
INFO [292e2535] Running /usr/bin/env mysqldump -u local_user --password='local_pw' --databases local_name -h 127.0.0.1 | bzip2 -9 > /var/www/vhosts/xxxxx/backups/database_local_name_2014-05-29_22:52:07.sql.bz2 on <server>
.. .env, .env, . , .env.production, !
script ( Dotenv gem):
require 'dotenv'
Dotenv.load '.env'
username, password, database, host = ENV['DB_USER'], ENV['DB_PASSWORD'], ENV['DB_NAME'], ENV['DB_HOST']
!