module DataKeeper::DatabaseConfig

Public Instance Methods

connection_args() click to toggle source
# File lib/data_keeper/database_config.rb, line 25
def connection_args
  connection_opts = '--host=:host'
  connection_opts += ' --port=:port' if database_connection_config['port']
  connection_opts
end
database() click to toggle source
# File lib/data_keeper/database_config.rb, line 17
def database
  database_connection_config['database']
end
database_connection_config() click to toggle source
# File lib/data_keeper/database_config.rb, line 3
def database_connection_config
  Rails.configuration.database_configuration[Rails.env]
end
host() click to toggle source
# File lib/data_keeper/database_config.rb, line 13
def host
  database_connection_config['host'] || '127.0.0.1'
end
port() click to toggle source
# File lib/data_keeper/database_config.rb, line 21
def port
  database_connection_config['port']
end
psql_env() click to toggle source
# File lib/data_keeper/database_config.rb, line 7
def psql_env
  env = { 'PGUSER' => database_connection_config['username'] }
  env['PGPASSWORD'] = database_connection_config['password'] if database_connection_config['password']
  env
end