Sha256: f81c074bbe95dd9d4f05fdf6b4f56bbaf789eb44572bdc89f26cc675b558449d

Contents?: true

Size: 841 Bytes

Versions: 5

Compression:

Stored size: 841 Bytes

Contents

module Octogate
  class ConfigLoader
    class << self
      def load_config(config_file)
        instance = new
        instance.instance_eval(File.read(config_file), config_file)
        instance.instance_eval do
          @_target_builders.each do |tb|
            Octogate.config.targets ||= {}
            Octogate.config.targets[tb.name] = tb.__to_target__
          end
        end
      end
    end

    def initialize
      @_target_builders = []
    end

    def token(token)
      Octogate.config.token = token
    end

    def target(name, &block)
      builder = TargetBuilder.new(name)
      builder.instance_eval(&block)
      @_target_builders << builder
    end

    def ca_file(ca_file)
      Octogate.config.ca_file = ca_file
    end

    def ssl_verify(verify)
      Octogate.config.ssl_verify = verify
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
octogate-0.4.0 lib/octogate/config_loader.rb
octogate-0.3.0 lib/octogate/config_loader.rb
octogate-0.2.2 lib/octogate/config_loader.rb
octogate-0.2.1 lib/octogate/config_loader.rb
octogate-0.2.0 lib/octogate/config_loader.rb