Module: Octokit::Default
- Defined in:
- lib/octokit/default.rb
Overview
Default configuration options for Client
Constant Summary collapse
- API_ENDPOINT =
Default API endpoint
'https://api.github.com'- USER_AGENT =
Default User Agent header string
"Octokit Ruby Gem #{Octokit::VERSION}"- MEDIA_TYPE =
Default media type
'application/vnd.github.v3+json'- WEB_ENDPOINT =
Default WEB endpoint
'https://github.com'- MIDDLEWARE =
Default Faraday middleware stack
Faraday::RackBuilder.new do |builder| # In Faraday 2.x, Faraday::Request::Retry was moved to a separate gem # so we use it only when it's available. if defined?(Faraday::Request::Retry) builder.use Faraday::Request::Retry, exceptions: [Octokit::ServerError] end if defined?(Faraday::Retry::Middleware) builder.use Faraday::Retry::Middleware, exceptions: [Octokit::ServerError] end builder.use Octokit::Middleware::FollowRedirects builder.use Octokit::Response::RaiseError builder.use Octokit::Response::FeedParser builder.adapter Faraday.default_adapter end
Class Method Summary collapse
-
.access_token ⇒ String
Default access token from ENV.
-
.api_endpoint ⇒ String
Default API endpoint from ENV or API_ENDPOINT.
-
.auto_paginate ⇒ String
Default pagination preference from ENV.
-
.bearer_token ⇒ String
Default bearer token from ENV.
-
.client_id ⇒ String
Default OAuth app key from ENV.
-
.client_secret ⇒ String
Default OAuth app secret from ENV.
-
.connection_options ⇒ Hash
Default options for Faraday::Connection.
-
.default_media_type ⇒ String
Default media type from ENV or MEDIA_TYPE.
-
.login ⇒ String
Default GitHub username for Basic Auth from ENV.
-
.management_console_endpoint ⇒ String
Default management console endpoint from ENV.
-
.management_console_password ⇒ String
Default management console password from ENV.
-
.middleware ⇒ Faraday::RackBuilder or Faraday::Builder
Default middleware stack for Faraday::Connection from MIDDLEWARE.
-
.netrc ⇒ Boolean
Default behavior for reading .netrc file.
-
.netrc_file ⇒ String
Default path for .netrc file.
-
.options ⇒ Hash
Configuration options.
-
.password ⇒ String
Default GitHub password for Basic Auth from ENV.
-
.per_page ⇒ Integer
Default pagination page size from ENV.
-
.proxy ⇒ String
Default proxy server URI for Faraday connection from ENV.
-
.ssl_verify_mode ⇒ Integer
Default SSL verify mode 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_token ⇒ String
Default access token from ENV
58 59 60 |
# File 'lib/octokit/default.rb', line 58 def access_token ENV['OCTOKIT_ACCESS_TOKEN'] end |
.api_endpoint ⇒ String
Default API endpoint from ENV or API_ENDPOINT
64 65 66 |
# File 'lib/octokit/default.rb', line 64 def api_endpoint ENV['OCTOKIT_API_ENDPOINT'] || API_ENDPOINT end |
.auto_paginate ⇒ String
Default pagination preference from ENV
70 71 72 |
# File 'lib/octokit/default.rb', line 70 def auto_paginate ENV['OCTOKIT_AUTO_PAGINATE'] end |
.bearer_token ⇒ String
Default bearer token from ENV
76 77 78 |
# File 'lib/octokit/default.rb', line 76 def bearer_token ENV['OCTOKIT_BEARER_TOKEN'] end |
.client_id ⇒ String
Default OAuth app key from ENV
82 83 84 |
# File 'lib/octokit/default.rb', line 82 def client_id ENV['OCTOKIT_CLIENT_ID'] end |
.client_secret ⇒ String
Default OAuth app secret from ENV
88 89 90 |
# File 'lib/octokit/default.rb', line 88 def client_secret ENV['OCTOKIT_SECRET'] end |
.connection_options ⇒ Hash
Default options for Faraday::Connection
106 107 108 109 110 111 112 113 |
# File 'lib/octokit/default.rb', line 106 def { headers: { accept: default_media_type, user_agent: user_agent } } end |
.default_media_type ⇒ String
Default media type from ENV or MEDIA_TYPE
117 118 119 |
# File 'lib/octokit/default.rb', line 117 def default_media_type ENV['OCTOKIT_DEFAULT_MEDIA_TYPE'] || MEDIA_TYPE end |
.login ⇒ String
Default GitHub username for Basic Auth from ENV
123 124 125 |
# File 'lib/octokit/default.rb', line 123 def login ENV['OCTOKIT_LOGIN'] end |
.management_console_endpoint ⇒ String
Default management console endpoint from ENV
100 101 102 |
# File 'lib/octokit/default.rb', line 100 def management_console_endpoint ENV['OCTOKIT_ENTERPRISE_MANAGEMENT_CONSOLE_ENDPOINT'] end |
.management_console_password ⇒ String
Default management console password from ENV
94 95 96 |
# File 'lib/octokit/default.rb', line 94 def management_console_password ENV['OCTOKIT_ENTERPRISE_MANAGEMENT_CONSOLE_PASSWORD'] end |
.middleware ⇒ Faraday::RackBuilder or Faraday::Builder
Default middleware stack for Faraday::Connection from MIDDLEWARE
130 131 132 |
# File 'lib/octokit/default.rb', line 130 def middleware MIDDLEWARE end |
.netrc ⇒ Boolean
Default behavior for reading .netrc file
177 178 179 |
# File 'lib/octokit/default.rb', line 177 def netrc ENV['OCTOKIT_NETRC'] || false end |
.netrc_file ⇒ String
Default path for .netrc file
183 184 185 |
# File 'lib/octokit/default.rb', line 183 def netrc_file ENV['OCTOKIT_NETRC_FILE'] || File.join(ENV['HOME'].to_s, '.netrc') end |
.options ⇒ Hash
Configuration options
52 53 54 |
# File 'lib/octokit/default.rb', line 52 def Hash[Octokit::Configurable.keys.map { |key| [key, send(key)] }] end |
.password ⇒ String
Default GitHub password for Basic Auth from ENV
136 137 138 |
# File 'lib/octokit/default.rb', line 136 def password ENV['OCTOKIT_PASSWORD'] end |
.per_page ⇒ Integer
Default pagination page size from ENV
142 143 144 145 146 |
# File 'lib/octokit/default.rb', line 142 def per_page page_size = ENV['OCTOKIT_PER_PAGE'] page_size&.to_i end |
.proxy ⇒ String
Default proxy server URI for Faraday connection from ENV
150 151 152 |
# File 'lib/octokit/default.rb', line 150 def proxy ENV['OCTOKIT_PROXY'] end |
.ssl_verify_mode ⇒ Integer
Default SSL verify mode from ENV
156 157 158 159 160 161 |
# File 'lib/octokit/default.rb', line 156 def ssl_verify_mode # 0 is OpenSSL::SSL::VERIFY_NONE # 1 is OpenSSL::SSL::SSL_VERIFY_PEER # the standard default for SSL is SSL_VERIFY_PEER which requires a server certificate check on the client ENV.fetch('OCTOKIT_SSL_VERIFY_MODE', 1).to_i end |
.user_agent ⇒ String
Default User-Agent header string from ENV or USER_AGENT
165 166 167 |
# File 'lib/octokit/default.rb', line 165 def user_agent ENV['OCTOKIT_USER_AGENT'] || USER_AGENT end |
.web_endpoint ⇒ String
Default web endpoint from ENV or WEB_ENDPOINT
171 172 173 |
# File 'lib/octokit/default.rb', line 171 def web_endpoint ENV['OCTOKIT_WEB_ENDPOINT'] || WEB_ENDPOINT end |