Sha256: c1140d61b89bbbb2367df2dd1f8bb55930142270fd10e26d2f8a831694cc04a6

Contents?: true

Size: 771 Bytes

Versions: 6

Compression:

Stored size: 771 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: "supermarket"
        }
      ]

    attribute 'build_interval',
      type: Float,
      default: 5.0

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
berkshelf-api-3.0.0 lib/berkshelf/api/config.rb
berkshelf-api-2.2.0 lib/berkshelf/api/config.rb
berkshelf-api-2.1.3 lib/berkshelf/api/config.rb
berkshelf-api-2.1.2 lib/berkshelf/api/config.rb
berkshelf-api-2.1.1 lib/berkshelf/api/config.rb
berkshelf-api-2.1.0 lib/berkshelf/api/config.rb