allow proxy env vars (#115)

This commit is contained in:
benzoid 2021-07-19 19:00:58 +01:00 committed by GitHub
parent 91bf85a150
commit 745e98161b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -91,13 +91,17 @@ module DockerManager
raise Discourse::NotFound unless repo.present?
script_path = File.expand_path(File.join(__dir__, '../../../scripts/docker_manager_upgrade.rb'))
pid = spawn(
{
env_vars = {
'UPGRADE_USER_ID' => current_user.id.to_s,
'UPGRADE_PATH' => params[:path].to_s,
'UPGRADE_REPO_VERSION' => repo_version(repo).to_s,
'RAILS_ENV' => Rails.env
},
}
["http_proxy","https_proxy","no_proxy","HTTP_PROXY","HTTPS_PROXY","NO_PROXY"].each do |p|
env_vars[p] = ENV[p] if ! ENV[p].nil?
end
pid = spawn(
env_vars,
"bundle exec rails runner #{script_path}"
)
Process.detach(pid)

View File

@ -168,6 +168,12 @@ class DockerManager::Upgrader
PATH
COMPRESS_BROTLI
FORCE_S3_UPLOADS
HTTP_PROXY
HTTPS_PROXY
NO_PROXY
http_proxy
https_proxy
no_proxy
}
clear_env = Hash[*ENV.map { |k, v| [k, nil] }