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.0.0.beta.9 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.beta.8 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.beta.7 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.beta.6 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.beta.5 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.beta.4 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.beta.3 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.beta.2 lib/lookbook/services/config_loader.rb
lookbook-1.5.3 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.beta.1 lib/lookbook/services/config_loader.rb
lookbook-1.5.2 lib/lookbook/services/config_loader.rb
lookbook-2.0.0.beta.0 lib/lookbook/services/config_loader.rb
lookbook-1.5.1 lib/lookbook/services/config_loader.rb
lookbook-1.5.0 lib/lookbook/services/config_loader.rb
lookbook-1.4.5 lib/lookbook/services/config_loader.rb
lookbook-1.4.4 lib/lookbook/services/config_loader.rb
lookbook-1.4.3 lib/lookbook/services/config_loader.rb
lookbook-1.4.2 lib/lookbook/services/config_loader.rb
lookbook-1.4.1 lib/lookbook/services/config_loader.rb
lookbook-1.4.0 lib/lookbook/services/config_loader.rb