Module: ChefAPI::Defaults
- Defined in:
- lib/chef-api/defaults.rb
Constant Summary collapse
- ENDPOINT =
Default API endpoint
'http://localhost:4000/'.freeze
- USER_AGENT =
Default User Agent header string
"ChefAPI Ruby Gem #{ChefAPI::VERSION}".freeze
Class Method Summary collapse
-
.client ⇒ String?
The name of the Chef API client.
-
.endpoint ⇒ String
The endpoint where the Chef Server lives.
-
.key ⇒ String?
The private key to authentication against the Chef Server.
-
.options ⇒ Hash
The list of calculated default options for the configuration.
-
.proxy_address ⇒ String?
The HTTP Proxy server address as a string.
-
.proxy_password ⇒ String?
The HTTP Proxy user password as a string.
-
.proxy_port ⇒ String?
The HTTP Proxy server port as a string.
-
.proxy_username ⇒ String?
The HTTP Proxy server username as a string.
-
.ssl_pem_file ⇒ String?
The path to a pem file on disk for use with a custom SSL verification.
-
.ssl_verify ⇒ true, false
Verify SSL requests (default: true).
-
.user_agent ⇒ String
The User Agent header to send along.
Class Method Details
.client ⇒ String?
The name of the Chef API client. This is the equivalent of client_name
in Chef terminology. In most cases, this is your Chef username.
56 57 58 |
# File 'lib/chef-api/defaults.rb', line 56 def client ENV['CHEF_API_CLIENT'] end |
.endpoint ⇒ String
The endpoint where the Chef Server lives. This is equivalent to the chef_server_url
in Chef terminology. If you are using Enterprise Hosted Chef or Enterprise Chef on premise, this endpoint includes your organization name, such as:
https://api.opscode.com/organizations/NAME
If you are running Open Source Chef Server or Chef Zero, this is just the URL to your Chef Server instance, such as:
http://chef.example.com/
36 37 38 |
# File 'lib/chef-api/defaults.rb', line 36 def endpoint ENV['CHEF_API_ENDPOINT'] || ENDPOINT end |
.key ⇒ String?
The private key to authentication against the Chef Server. This is equivalent to the client_key
in Chef terminology. This value can be the client key in plain text or a path to the key on disk.
67 68 69 |
# File 'lib/chef-api/defaults.rb', line 67 def key ENV['CHEF_API_KEY'] end |
.options ⇒ Hash
The list of calculated default options for the configuration.
17 18 19 |
# File 'lib/chef-api/defaults.rb', line 17 def Hash[Configurable.keys.map { |key| [key, send(key)] }] end |
.proxy_address ⇒ String?
The HTTP Proxy server address as a string
75 76 77 |
# File 'lib/chef-api/defaults.rb', line 75 def proxy_address ENV['CHEF_API_PROXY_ADDRESS'] end |
.proxy_password ⇒ String?
The HTTP Proxy user password as a string
84 85 86 |
# File 'lib/chef-api/defaults.rb', line 84 def proxy_password ENV['CHEF_API_PROXY_PASSWORD'] end |
.proxy_port ⇒ String?
The HTTP Proxy server port as a string
93 94 95 |
# File 'lib/chef-api/defaults.rb', line 93 def proxy_port ENV['CHEF_API_PROXY_PORT'] end |
.proxy_username ⇒ String?
The HTTP Proxy server username as a string
102 103 104 |
# File 'lib/chef-api/defaults.rb', line 102 def proxy_username ENV['CHEF_API_PROXY_USERNAME'] end |
.ssl_pem_file ⇒ String?
The path to a pem file on disk for use with a custom SSL verification
111 112 113 |
# File 'lib/chef-api/defaults.rb', line 111 def ssl_pem_file ENV['CHEF_API_SSL_PEM_FILE'] end |
.ssl_verify ⇒ true, false
Verify SSL requests (default: true)
120 121 122 123 124 125 126 |
# File 'lib/chef-api/defaults.rb', line 120 def ssl_verify if ENV['CHEF_API_SSL_VERIFY'].nil? true else %w[t y].include?(ENV['CHEF_API_SSL_VERIFY'].downcase[0]) end end |
.user_agent ⇒ String
The User Agent header to send along.
45 46 47 |
# File 'lib/chef-api/defaults.rb', line 45 def user_agent ENV['CHEF_API_USER_AGENT'] || USER_AGENT end |