mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 10:55:30 -04:00
Check bool environment variables are "1" or "true"
This commit is contained in:
parent
8931ba8c43
commit
7a7cb78f82
@ -61,3 +61,9 @@ class String
|
|||||||
self.chars.all? { |c| c.alphanumeric? || c == '_' }
|
self.chars.all? { |c| c.alphanumeric? || c == '_' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def env_is_true?(key : String) : Bool
|
||||||
|
val = ENV[key.upcase]? || ENV[key.downcase]?
|
||||||
|
return false unless val
|
||||||
|
val.downcase.in? "1", "true"
|
||||||
|
end
|
||||||
|
@ -86,9 +86,7 @@ module HTTP
|
|||||||
class Client
|
class Client
|
||||||
private def self.exec(uri : URI, tls : TLSContext = nil)
|
private def self.exec(uri : URI, tls : TLSContext = nil)
|
||||||
previous_def uri, tls do |client, path|
|
previous_def uri, tls do |client, path|
|
||||||
disable_ssl_verification = ENV["DISABLE_SSL_VERIFICATION"]? ||
|
if client.tls? && env_is_true? "DISABLE_SSL_VERIFICATION"
|
||||||
ENV["disable_ssl_verification"]?
|
|
||||||
if disable_ssl_verification && client.tls?
|
|
||||||
Logger.debug "Disabling SSL verification"
|
Logger.debug "Disabling SSL verification"
|
||||||
client.tls.verify_mode = OpenSSL::SSL::VerifyMode::NONE
|
client.tls.verify_mode = OpenSSL::SSL::VerifyMode::NONE
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user