Module: Rancher::Default
- Defined in:
- lib/rancher/default.rb
Overview
Default configuration options for Client
Constant Summary collapse
- API_ENDPOINT =
Default API endpoint
'http://localhost:8080/v1/projects/1a5'.freeze
- USER_AGENT =
Default User Agent header string
"Rancher Ruby Gem #{Rancher::VERSION}".freeze
- MEDIA_TYPE =
Default media type
'application/json'.freeze
- RACK_BUILDER_CLASS =
In Faraday 0.9, Faraday::Builder was renamed to Faraday::RackBuilder
defined?(Faraday::RackBuilder) ? Faraday::RackBuilder : Faraday::Builder
- MIDDLEWARE =
Default Faraday middleware stack
RACK_BUILDER_CLASS.new do |builder| builder.use Rancher::Middleware::FollowRedirects builder.use Rancher::Response::RaiseError builder.adapter Faraday.default_adapter end
Class Method Summary collapse
-
.access_key ⇒ String
Default OAuth app key from ENV.
-
.api_endpoint ⇒ String
Default API endpoint from ENV or API_ENDPOINT.
-
.auto_paginate ⇒ String
Default pagination preference from ENV.
-
.connection_options ⇒ Hash
Default options for Faraday::Connection.
-
.default_media_type ⇒ String
Default media type from ENV or MEDIA_TYPE.
-
.middleware ⇒ String
Default middleware stack for Faraday::Connection from MIDDLEWARE.
-
.options ⇒ Hash
Configuration options.
-
.per_page ⇒ Fixnum
Default pagination page size from ENV.
-
.proxy ⇒ String
Default proxy server URI for Faraday connection from ENV.
-
.secret_key ⇒ String
Default OAuth app secret from ENV.
-
.user_agent ⇒ String
Default User-Agent header string from ENV or USER_AGENT.
-
.web_endpoint ⇒ String
Default web endpoint from ENV or WEB_ENDPOINT.
Class Method Details
.access_key ⇒ String
Default OAuth app key from ENV
48 49 50 |
# File 'lib/rancher/default.rb', line 48 def access_key ENV['RANCHER_CLIENT_ID'] end |
.api_endpoint ⇒ String
Default API endpoint from ENV or API_ENDPOINT
36 37 38 |
# File 'lib/rancher/default.rb', line 36 def api_endpoint ENV['RANCHER_API_ENDPOINT'] || API_ENDPOINT end |
.auto_paginate ⇒ String
Default pagination preference from ENV
42 43 44 |
# File 'lib/rancher/default.rb', line 42 def auto_paginate ENV['RANCHER_AUTO_PAGINATE'] end |
.connection_options ⇒ Hash
Default options for Faraday::Connection
60 61 62 63 64 65 66 67 |
# File 'lib/rancher/default.rb', line 60 def { headers: { accept: default_media_type, user_agent: user_agent } } end |
.default_media_type ⇒ String
Default media type from ENV or MEDIA_TYPE
71 72 73 |
# File 'lib/rancher/default.rb', line 71 def default_media_type ENV['RANCHER_DEFAULT_MEDIA_TYPE'] || MEDIA_TYPE end |
.middleware ⇒ String
Default middleware stack for Faraday::Connection from MIDDLEWARE
78 79 80 |
# File 'lib/rancher/default.rb', line 78 def middleware MIDDLEWARE end |
.options ⇒ Hash
Configuration options
30 31 32 |
# File 'lib/rancher/default.rb', line 30 def Hash[Rancher::Configurable.keys.map { |key| [key, send(key)] }] end |
.per_page ⇒ Fixnum
Default pagination page size from ENV
84 85 86 87 88 |
# File 'lib/rancher/default.rb', line 84 def per_page page_size = ENV['RANCHER_PER_PAGE'] page_size.to_i if page_size end |
.proxy ⇒ String
Default proxy server URI for Faraday connection from ENV
92 93 94 |
# File 'lib/rancher/default.rb', line 92 def proxy ENV['RANCHER_PROXY'] end |
.secret_key ⇒ String
Default OAuth app secret from ENV
54 55 56 |
# File 'lib/rancher/default.rb', line 54 def secret_key ENV['RANCHER_SECRET'] end |
.user_agent ⇒ String
Default User-Agent header string from ENV or USER_AGENT
98 99 100 |
# File 'lib/rancher/default.rb', line 98 def user_agent ENV['RANCHER_USER_AGENT'] || USER_AGENT end |
.web_endpoint ⇒ String
Default web endpoint from ENV or WEB_ENDPOINT
104 105 106 |
# File 'lib/rancher/default.rb', line 104 def web_endpoint ENV['RANCHER_WEB_ENDPOINT'] || WEB_ENDPOINT end |