Sha256: 3cd7a39d46e523630c77f4a9c7ba894563703359de3b2005ab93aef55102d1dc
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require 'erb' require 'yaml' require 'rubypitaya/core/setup' module RubyPitaya class DatabaseConfig def initialize(setup) @config = { 'adapter' => 'postgresql', 'encoding' => 'unicode', 'pool' => setup.fetch('rubypitaya.database.pool', 5), 'host' => setup['rubypitaya.database.host'], 'port' => setup['rubypitaya.database.port'], 'user' => setup['rubypitaya.database.user'], 'password' => setup['rubypitaya.database.password'], 'database' => setup['rubypitaya.database.name'], } environment_name = setup.fetch('rubypitaya.server.environment', 'development') @config['database'] = "#{@config['database']}_test" if environment_name == 'test' end def config @config end def connection_data { 'adapter': config['adapter'], 'encoding': config['encoding'], 'pool': config['pool'], 'host': config['host'], 'port': config['port'], 'user': config['user'], 'password': config['password'], 'database': config['database'], } end def connection_data_without_database { 'adapter': config['adapter'], 'encoding': config['encoding'], 'pool': config['pool'], 'host': config['host'], 'user': config['user'], 'password': config['password'], } end def database_name config['database'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubypitaya-3.17.0 | ./lib/rubypitaya/core/database_config.rb |