Sha256: 05e461f0b31f0547a5fbe93c0f3a0c54229f8198f8db383a3d29c92e82d17444

Contents?: true

Size: 785 Bytes

Versions: 8

Compression:

Stored size: 785 Bytes

Contents

require 'buff/config/json'
require 'digest/sha1'

module Berkshelf::API
  class Config < Buff::Config::JSON
    class << self
      # @return [String]
      def default_path
        home_path = ENV['BERKSHELF_API_PATH'] || "#{ENV['HOME']}/.berkshelf/api-server"
        File.expand_path(File.join(home_path, "config.json"))
      end
    end

    attribute 'home_path',
      type: String,
      default: File.expand_path("#{ENV['HOME']}/.berkshelf/api-server")

    attribute 'endpoints',
      type: Array,
      default: [
        {
          type: "opscode",
          options: {
            url: 'http://cookbooks.opscode.com/api/v1'
          }
        }
      ]

    def endpoints_checksum
      Digest::SHA1.hexdigest(endpoints.collect {|x| x.to_hash }.to_s)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
berkshelf-api-1.4.0 lib/berkshelf/api/config.rb
berkshelf-api-1.3.1 lib/berkshelf/api/config.rb
berkshelf-api-1.3.0 lib/berkshelf/api/config.rb
berkshelf-api-1.2.2 lib/berkshelf/api/config.rb
berkshelf-api-1.2.1 lib/berkshelf/api/config.rb
berkshelf-api-1.2.0 lib/berkshelf/api/config.rb
berkshelf-api-1.2.0.rc2 lib/berkshelf/api/config.rb
berkshelf-api-1.2.0.rc1 lib/berkshelf/api/config.rb