Skip to content

Commit

Permalink
Do not read current config
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Aug 16, 2023
1 parent 999718d commit b1c76c5
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions service/lib/agama/proxy_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,33 +75,33 @@ def proxy_from_cmdline
end

def proxy_import_settings
ex = Proxy.Export
proto = proxy.scheme

# save user name and password separately
ex["proxy_user"] = proxy.user
settings = {
"proxy_user" => proxy.user,
"proxy_password" => proxy.password,
"enabled" => true
}
proxy.user = nil
ex["proxy_password"] = proxy.password
proxy.password = nil
ex["#{proto}_proxy"] = proxy.to_s

settings["#{proto}_proxy"] = proxy.to_s
# Use the proxy also for https and ftp
if proto == "http"
ex["https_proxy"] = proxy.to_s
ex["ftp_proxy"] = proxy.to_s
settings["https_proxy"] = proxy.to_s
settings["ftp_proxy"] = proxy.to_s
end
ex["enabled"] = true
ex
settings
end

def write
return unless proxy

Proxy.Read
ex = proxy_import_settings
Proxy.Import(ex)
settings = proxy_import_settings
Proxy.Import(settings)

log.info "Writing proxy settings: #{proxy.scheme}_proxy = '#{proxy}'"
log.debug "Writing proxy settings: #{ex}"
log.debug "Writing proxy settings: #{settings}"

Proxy.Write
end
Expand Down

0 comments on commit b1c76c5

Please sign in to comment.