Sha256: 177b0a16e28abbb5f932b1a8a430ca2215e62820037741bbaaaaa47823f4fcbf

Contents?: true

Size: 505 Bytes

Versions: 46

Compression:

Stored size: 505 Bytes

Contents

module Lookbook
  class ConfigLoader < Service
    attr_reader :file, :env

    def initialize(path, env: Rails.env)
      @file = Engine.root.join(path)
      @env = env.to_sym
    end

    def call
      if file.exist?
        config = YAML.load_file(file).deep_symbolize_keys
        env_config = config[:shared].to_h.deep_merge(config[env].to_h)
        Store.new(env_config)
      else
        raise ConfigError.new("Could not load configuration. No such file - #{file}")
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
lookbook-2.3.4 lib/lookbook/services/config_loader.rb
lookbook-2.3.3 lib/lookbook/services/config_loader.rb
lookbook-2.3.2 lib/lookbook/services/config_loader.rb
lookbook-2.3.0 lib/lookbook/services/config_loader.rb
lookbook-2.2.2 lib/lookbook/services/config_loader.rb
lookbook-2.2.1 lib/lookbook/services/config_loader.rb
lookbook-2.2.0 lib/lookbook/services/config_loader.rb
lookbook-2.1.1 lib/lookbook/services/config_loader.rb
lookbook-2.1.0 lib/lookbook/services/config_loader.rb
lookbook-2.0.5 lib/lookbook/services/config_loader.rb
lookbook-2.0.4 lib/lookbook/services/config_loader.rb
lookbook-2.0.3 lib/lookbook/services/config_loader.rb
lookbook-2.0.2 lib/lookbook/services/config_loader.rb
lookbook-2.0.1 lib/lookbook/services/config_loader.rb
lookbook-2.0.0 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.rc.3 lib/lookbook/services/config_loader.rb
lookbook-1.5.5 lib/lookbook/services/config_loader.rb
lookbook-1.5.4 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.rc.2 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.rc.1 lib/lookbook/services/config_loader.rb