Sha256: 3cd1383e7b4ad8936bf716a0dc61f9e518f27829791ef925204cc27bd3bd788c

Contents?: true

Size: 735 Bytes

Versions: 2

Compression:

Stored size: 735 Bytes

Contents

# frozen_string_literal: true

module ConfigDefault::RailsApplicationConfigurationPatch
  def load_database_yaml
    ConfigDefault.load(:database, key: nil)
  end

  def database_configuration
    load_database_yaml
  end
end

module ConfigDefault::RailsApplicationPatch
  def config_for(name, env: Rails.env)
    data = ConfigDefault.load(name, key: env, deep_symbolize_keys: true)
    ActiveSupport::OrderedOptions.new.merge(data)
  end
end

module ConfigDefault::Init
  extend self

  def init_rails_patch!
    return unless Object.const_defined?(:Rails)

    Rails::Application.prepend(ConfigDefault::RailsApplicationPatch)
    Rails::Application::Configuration.prepend(ConfigDefault::RailsApplicationConfigurationPatch)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
config_default-0.3.1 lib/config_default/init.rb
config_default-0.3.0 lib/config_default/init.rb