Class: Orchestration::Services::Database::Configuration
- Inherits:
-
Object
- Object
- Orchestration::Services::Database::Configuration
show all
- Includes:
- ConfigurationBase
- Defined in:
- lib/orchestration/services/database/configuration.rb
Instance Attribute Summary
#env, #error, #service_name
Instance Method Summary
collapse
#image, included, #initialize, #parse_port, #service, #yaml
Instance Method Details
#adapter ⇒ Object
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/orchestration/services/database/configuration.rb', line 40
def adapter
url_adapter = url_config['adapter']
file_adapter = file_config['adapter']
return adapter_by_name(url_adapter) unless url_adapter.nil?
return adapter_by_name(file_adapter) unless file_adapter.nil?
return adapter_by_name('sqlite3') if defined?(SQLite3)
nil
end
|
32
33
34
|
# File 'lib/orchestration/services/database/configuration.rb', line 32
def configured?
sqlite? || super
end
|
#console_command ⇒ Object
36
37
38
|
# File 'lib/orchestration/services/database/configuration.rb', line 36
def console_command
adapter.console_command
end
|
#enabled? ⇒ Boolean
11
12
13
|
# File 'lib/orchestration/services/database/configuration.rb', line 11
def enabled?
defined?(::ActiveRecord)
end
|
#friendly_config ⇒ Object
15
16
17
18
19
|
# File 'lib/orchestration/services/database/configuration.rb', line 15
def friendly_config
return "[#{adapter.name}]" if sqlite?
"[#{adapter.name}] #{adapter.name}://#{username}:#{password}@#{host}:#{port}/#{database}"
end
|
#settings(healthcheck: false) ⇒ Object
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/orchestration/services/database/configuration.rb', line 21
def settings(healthcheck: false)
{
adapter: adapter.name,
host:,
port:,
username:,
password:,
database: healthcheck ? adapter.credentials['database'] : database
}.transform_keys(&:to_s)
end
|