Sha256: 51f6fa36f78492283ddd588d58750c5cb31dbb5a13cada19698ca192a879effc

Contents?: true

Size: 723 Bytes

Versions: 5

Compression:

Stored size: 723 Bytes

Contents

require 'muchkeys'
require 'uri'

module MuchKeys
  class Configuration
    attr_accessor :consul_url, :private_key, :public_key, :application_name, :search_paths, :secrets_hint

    # sensible defaults
    def initialize
      @consul_url = "http://localhost:8500"
    end

    # url parsing sanity check
    def consul_url=(url)
      raise URI::InvalidURIError unless url =~ URI::regexp
      @consul_url = url
    end

    def attributes
      {
        consul_url:  @consul_url,
        private_key: @private_key,
        public_key:  @public_key,
        application_name: @application_name,
        search_paths: @search_paths,
        secrets_hint: @secrets_hint
      }.delete_if {|k,v| v.nil? }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
muchkeys-0.5.0 lib/muchkeys/configuration.rb
muchkeys-0.4.0 lib/muchkeys/configuration.rb
muchkeys-0.3.7 lib/muchkeys/configuration.rb
muchkeys-0.3.6 lib/muchkeys/configuration.rb
muchkeys-0.3.3 lib/muchkeys/configuration.rb