lib/capistrano/sync.rb
#
# Reads the database credentials from the local config/database.yml file
# +db+ the name of the environment to get the credentials for
# Returns username, password, database
#
Reads the database credentials from the local config/database.yml file
+db+ the name of the environment to get the credentials for
Returns username, password, database
Reads the database credentials from the local config / database . yml file + db + the name of the environment to get the credentials for Returns username password database
def database_config(db)
    local_config = File.read('config/database.yml')
    local_env = File.read('.env')
    database = nil
    EnvLoader.new(local_env).with_loaded_env do
      database = YAML::load(ERB.new(local_config).result)
    end
    return database["#{db}"]['username'], database["#{db}"]['password'], database["#{db}"]['database'], database["#{db}"]['host']
  end
def database_config ( db ) local_config = File . read ( 'config/database.yml' ) local_env = File . read ( '.env' ) database = nil EnvLoader . new ( local_env ) . with_loaded_env do database = YAML :: load ( ERB . new ( local_config ) . result ) end return database [ "#{db}" ] [ 'username' ] , database [ "#{db}" ] [ 'password' ] , database [ "#{db}" ] [ 'database' ] , database [ "#{db}" ] [ 'host' ] end
Reads the database credentials from the local config/database.yml file
+db+ the name of the environment to get the credentials for
Returns username, password, database
Reads the database credentials from the local config / database . yml file + db + the name of the environment to get the credentials for Returns username password database
db
<not_specific>