lib/danger/request_sources/github/github.rb in danger-5.4.0 vs lib/danger/request_sources/github/github.rb in danger-5.4.1
- old
+ new
@@ -19,11 +19,11 @@
def self.env_vars
["DANGER_GITHUB_API_TOKEN"]
end
def self.optional_env_vars
- ["DANGER_GITHUB_HOST", "DANGER_GITHUB_API_BASE_URL"]
+ ["DANGER_GITHUB_HOST", "DANGER_GITHUB_API_BASE_URL", "DANGER_OCTOKIT_VERIFY_SSL"]
end
def initialize(ci_source, environment)
self.ci_source = ci_source
self.environment = environment
@@ -43,10 +43,14 @@
def host
@host = @environment["DANGER_GITHUB_HOST"] || "github.com"
end
+ def verify_ssl
+ @environment["DANGER_OCTOKIT_VERIFY_SSL"] == "false" ? false : true
+ end
+
# `DANGER_GITHUB_API_HOST` is the old name kept for legacy reasons and
# backwards compatibility. `DANGER_GITHUB_API_BASE_URL` is the new
# correctly named variable.
def api_url
@environment.fetch("DANGER_GITHUB_API_HOST") do
@@ -56,11 +60,13 @@
end
end
def client
raise "No API token given, please provide one using `DANGER_GITHUB_API_TOKEN`" if !@token && !support_tokenless_auth
-
@client ||= begin
+ Octokit.configure do |config|
+ config.connection_options[:ssl] = { verify: verify_ssl }
+ end
Octokit::Client.new(access_token: @token, auto_paginate: true, api_endpoint: api_url)
end
end
def pr_diff