Module: VagrantCloud::Defaults

Included in:
Configurable
Defined in:
lib/vagrant-cloud/defaults.rb

Constant Summary collapse

USER_AGENT =

Default User Agent header string

"Vagrant Cloud Ruby Gem #{VagrantCloud::VERSION}".freeze

Class Method Summary collapse

Class Method Details

.access_tokenString?

The Vagrant Cloud access token to authenticate with.

Returns:

  • (String, nil)


49
50
51
# File 'lib/vagrant-cloud/defaults.rb', line 49

def access_token
  ENV['VAGRANT_CLOUD_ACCESS_TOKEN']
end

.endpointString

The Vagrant Cloud endpoint. For enterprise installations, this must be overriden. Defaults to the public Vagrant Cloud installation.

Returns:

  • (String)


22
23
24
# File 'lib/vagrant-cloud/defaults.rb', line 22

def endpoint
  ENV['VAGRANT_CLOUD_ENDPOINT'] || 'https://vagrantcloud.com/api/v1'
end

.optionsHash

The list of calculated default options for the configuration.

Returns:

  • (Hash)


12
13
14
# File 'lib/vagrant-cloud/defaults.rb', line 12

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

.proxy_addressString?

The HTTP Proxy server address.

Returns:

  • (String, nil)


58
59
60
# File 'lib/vagrant-cloud/defaults.rb', line 58

def proxy_address
  ENV['VAGRANT_CLOUD_PROXY_ADDRESS']
end

.proxy_passwordString?

The HTTP Proxy server user’s password.

Returns:

  • (String, nil)


67
68
69
# File 'lib/vagrant-cloud/defaults.rb', line 67

def proxy_password
  ENV['VAGRANT_CLOUD_PROXY_PASSWORD']
end

.proxy_portString?

The HTTP Proxy server port.

Returns:

  • (String, nil)


76
77
78
# File 'lib/vagrant-cloud/defaults.rb', line 76

def proxy_port
  ENV['VAGRANT_CLOUD_PROXY_PORT']
end

.proxy_usernameString?

The HTTP Proxy server username.

Returns:

  • (String, nil)


85
86
87
# File 'lib/vagrant-cloud/defaults.rb', line 85

def proxy_username
  ENV['VAGRANT_CLOUD_PROXY_USERNAME']
end

.ssl_pem_fileString?

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

Returns:

  • (String, nil)


94
95
96
# File 'lib/vagrant-cloud/defaults.rb', line 94

def ssl_pem_file
  ENV['VAGRANT_CLOUD_SSL_PEM_FILE']
end

.ssl_verifytrue, false

Verify SSL requests (default: true)

Returns:

  • (true, false)


103
104
105
106
# File 'lib/vagrant-cloud/defaults.rb', line 103

def ssl_verify
  key = ENV.fetch('VAGRANT_CLOUD_SSL_VERIFY', 'yes').downcase[0]
  %w[1 t y].include?(key)
end

.user_agentString

The User Agent header to send along.

Returns:

  • (String)


31
32
33
# File 'lib/vagrant-cloud/defaults.rb', line 31

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

.usernameString?

The Vagrant Cloud username or organization to authenticate with.

Returns:

  • (String, nil)


40
41
42
# File 'lib/vagrant-cloud/defaults.rb', line 40

def username
  ENV['VAGRANT_CLOUD_USERNAME']
end