Module: RrxConfig
- Defined in:
- lib/rrx_config.rb,
lib/rrx_config/aws.rb,
lib/rrx_config/error.rb,
lib/rrx_config/railtie.rb,
lib/rrx_config/version.rb,
lib/rrx_config/environment.rb,
lib/rrx_config/sources/base.rb,
lib/rrx_config/configuration.rb,
lib/rrx_config/database_config.rb,
lib/rrx_config/sources/local_source.rb,
lib/rrx_config/sources/aws_secret_source.rb,
lib/rrx_config/sources/environment_source.rb,
lib/rrx_config/database_config/iam_hash_config.rb
Defined Under Namespace
Modules: Aws, DatabaseConfig, Sources
Classes: Configuration, Environment, EnvironmentError, Error, Railtie
Constant Summary
collapse
- VERSION =
"0.1.2"
Class Method Summary
collapse
Class Method Details
.debug(msg) ⇒ Object
29
30
31
|
# File 'lib/rrx_config.rb', line 29
def debug(msg)
log(:debug, msg)
end
|
.env ⇒ Object
Primary accessor for getting the environment
.error(msg) ⇒ Object
37
38
39
|
# File 'lib/rrx_config.rb', line 37
def error(msg)
log(:error, msg)
end
|
.info(msg) ⇒ Object
33
34
35
|
# File 'lib/rrx_config.rb', line 33
def info(msg)
log(:info, msg)
end
|
.log(level, msg) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/rrx_config.rb', line 20
def log(level, msg)
logger = self.logger
if logger
logger.send(level.to_sym, msg)
else
puts "[RRX_CONFIG][#{level.to_s.upcase}] #{msg}"
end
end
|
.logger ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/rrx_config.rb', line 10
def logger
if defined?(Rails) && Rails.logger
if Rails.logger.respond_to?(:scoped)
Rails.logger.scoped(name: 'rrx_config')
else
Rails.logger
end
end
end
|
.method_missing(name) ⇒ Object
Allow config values to be read directly from RrxConfig.xxxx
51
52
53
54
55
56
57
|
# File 'lib/rrx_config/configuration.rb', line 51
def self.method_missing(name, ...)
if name.end_with?('?')
respond_to_missing?(name.to_s.chop.to_sym)
else
Configuration.instance.current.send(name, ...)
end
end
|
.respond_to_missing? ⇒ Boolean
45
46
47
|
# File 'lib/rrx_config/configuration.rb', line 45
def self.respond_to_missing?(...)
Configuration.instance.current.respond_to?(...)
end
|