Module: Osbourne::Config::FileLoader
- Defined in:
- lib/osbourne/config/file_loader.rb
Class Method Summary collapse
Class Method Details
.load(cfile, environment = "development") ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/osbourne/config/file_loader.rb', line 10 def self.load(cfile, environment="development") return false unless should_run?(cfile) base_opts = YAML.safe_load(ERB.new(IO.read(cfile)).result) || {} env_opts = base_opts[environment] || {} Osbourne.config.sns_config = env_opts["publisher"]&.symbolize_keys || {} Osbourne.config.sqs_config = env_opts["subscriber"]&.symbolize_keys || {} true end |
.should_run?(cfile) ⇒ Boolean
21 22 23 |
# File 'lib/osbourne/config/file_loader.rb', line 21 def self.should_run?(cfile) File.exist?(cfile) && !Osbourne.test_mode? end |