Module: Artifactory::Defaults

Defined in:
lib/artifactory/defaults.rb

Constant Summary collapse

ENDPOINT =

Default API endpoint

'http://localhost:8080/artifactory'.freeze
USER_AGENT =

Default User Agent header string

"Artifactory Ruby Gem #{Artifactory::VERSION}".freeze

Class Method Summary collapse

Class Method Details

.endpointString

The endpoint where artifactory lives

Returns:

  • (String)


42
43
44
# File 'lib/artifactory/defaults.rb', line 42

def endpoint
  ENV['ARTIFACTORY_ENDPOINT'] || ENDPOINT
end

.optionsHash

The list of calculated default options for the configuration.

Returns:

  • (Hash)


33
34
35
# File 'lib/artifactory/defaults.rb', line 33

def options
  Hash[Configurable.keys.map { |key| [key, send(key)] }]
end

.passwordString?

The HTTP Basic Authentication password

Returns:

  • (String, nil)


69
70
71
# File 'lib/artifactory/defaults.rb', line 69

def password
  ENV['ARTIFACTORY_PASSWORD']
end

.proxy_addressString?

The HTTP Proxy server address as a string

Returns:

  • (String, nil)


78
79
80
# File 'lib/artifactory/defaults.rb', line 78

def proxy_address
  ENV['ARTIFACTORY_PROXY_ADDRESS']
end

.proxy_passwordString?

The HTTP Proxy user password as a string

Returns:

  • (String, nil)


87
88
89
# File 'lib/artifactory/defaults.rb', line 87

def proxy_password
  ENV['ARTIFACTORY_PROXY_PASSWORD']
end

.proxy_portString?

The HTTP Proxy server port as a string

Returns:

  • (String, nil)


96
97
98
# File 'lib/artifactory/defaults.rb', line 96

def proxy_port
  ENV['ARTIFACTORY_PROXY_PORT']
end

.proxy_usernameString?

The HTTP Proxy server username as a string

Returns:

  • (String, nil)


105
106
107
# File 'lib/artifactory/defaults.rb', line 105

def proxy_username
  ENV['ARTIFACTORY_PROXY_USERNAME']
end

.read_timeoutInteger

Number of seconds to wait for a response from Artifactory

Returns:

  • (Integer)


136
137
138
139
140
141
142
# File 'lib/artifactory/defaults.rb', line 136

def read_timeout
  if ENV['ARTIFACTORY_READ_TIMEOUT']
    ENV['ARTIFACTORY_READ_TIMEOUT'].to_i
  else
    120
  end
end

.ssl_pem_fileString?

The path to a pem file on disk for use with a custom SSL verification

Returns:

  • (String, nil)


114
115
116
# File 'lib/artifactory/defaults.rb', line 114

def ssl_pem_file
  ENV['ARTIFACTORY_SSL_PEM_FILE']
end

.ssl_verifytrue, false

Verify SSL requests (default: true)

Returns:

  • (true, false)


123
124
125
126
127
128
129
# File 'lib/artifactory/defaults.rb', line 123

def ssl_verify
  if ENV['ARTIFACTORY_SSL_VERIFY'].nil?
    true
  else
    %w[t y].include?(ENV['ARTIFACTORY_SSL_VERIFY'].downcase[0])
  end
end

.user_agentString

The User Agent header to send along

Returns:

  • (String)


51
52
53
# File 'lib/artifactory/defaults.rb', line 51

def user_agent
  ENV['ARTIFACTORY_USER_AGENT'] || USER_AGENT
end

.usernameString?

The HTTP Basic Authentication username

Returns:

  • (String, nil)


60
61
62
# File 'lib/artifactory/defaults.rb', line 60

def username
  ENV['ARTIFACTORY_USERNAME']
end