Sha256: cfc57300b27f3c19757f8bec04259e5f8ffe4ba91b10e4f3389c32d288a7a2ec

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require "ftw"

# Experimentation with an agent configuration similar to Firefox's about:config
module FTW::Agent::Configuration
  # The config key for setting how many redirects will be followed before
  # giving up.
  REDIRECTION_LIMIT = "redirection-limit".freeze

  # SSL Trust Store
  SSL_TRUST_STORE = "ssl.trustdb".freeze

  # SSL: Use the system's global default certs?
  SSL_USE_DEFAULT_CERTS = "ssl.use-default-certs".freeze

  private

  # Get the configuration hash
  def configuration
    return @configuration ||= default_configuration
  end # def configuration

  # default configuration
  def default_configuration
    require "tmpdir"
    home = File.join(ENV.fetch("HOME", tmpdir), ".ftw")
    return {
      REDIRECTION_LIMIT => 20,
      SSL_TRUST_STORE => File.join(home, "ssl-trust.db"),
      SSL_USE_DEFAULT_CERTS => true,
    }
  end # def default_configuration

  def tmpdir
    return File.join(Dir.tmpdir, "ftw-#{Process.uid}")
  end # def tmpdir

  public(:configuration)
end # def FTW::Agent::Configuration

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ftw-0.0.41 lib/ftw/agent/configuration.rb