mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
parent
e61d625048
commit
a23b39afa7
1 changed files with 12 additions and 4 deletions
|
@ -54,18 +54,26 @@ def extract_proxy_values_from_uri(proxy_uri)
|
|||
}
|
||||
end
|
||||
|
||||
def get_proxy(key)
|
||||
ENV[key.downcase] || ENV[key.upcase]
|
||||
end
|
||||
|
||||
def valid_proxy?(proxy)
|
||||
!proxy.nil? && !proxy.strip.empty?
|
||||
end
|
||||
|
||||
def configure_proxy
|
||||
proxies = []
|
||||
proxy = (ENV["http_proxy"] || ENV["HTTP_PROXY"])
|
||||
if !proxy.nil? && !proxy.strip.empty?
|
||||
proxy = get_proxy("http_proxy")
|
||||
if valid_proxy?(proxy)
|
||||
proxy_settings = extract_proxy_values_from_uri(proxy)
|
||||
proxy_settings[:protocol] = "http"
|
||||
apply_env_proxy_settings(proxy_settings)
|
||||
proxies << proxy_settings
|
||||
end
|
||||
|
||||
proxy = (ENV["https_proxy"] || ENV["HTTPS_PROXY"])
|
||||
if !proxy.nil? && !proxy.strip.empty?
|
||||
proxy = get_proxy("https_proxy")
|
||||
if valid_proxy?(proxy)
|
||||
proxy_settings = extract_proxy_values_from_uri(proxy)
|
||||
proxy_settings[:protocol] = "https"
|
||||
apply_env_proxy_settings(proxy_settings)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue