diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 14fb285f4f8c632c42ef305f014cda831baac29b..e4fd20f9454c70dfbddc39954f501422949b1bfa 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -159,6 +159,13 @@ production: &base # Number of seconds to wait for HTTP response after sending webhook HTTP POST request (default: 10) # webhook_timeout: 10 + ## HTTP client settings + http_client: + # Filename of HTTP client pem + # tls_client_cert_file: + # PEM password (optional) + # tls_client_cert_password: + ### GraphQL Settings # Tells the rails application how long it has to complete a GraphQL request. # We suggest this value to be higher than the database timeout value diff --git a/config/initializers/gitlab_http.rb b/config/initializers/gitlab_http.rb index 8a84313a7fb9260bd91ef3a97c46505b0c49e8c5..cd891f29584ea05121b75736b4e4cc2439b1c0f9 100644 --- a/config/initializers/gitlab_http.rb +++ b/config/initializers/gitlab_http.rb @@ -24,3 +24,11 @@ Gitlab::SilentMode.log_info(message: message, outbound_http_request_method: http_method) end end + +if Gitlab.config.gitlab['http_client'] + pem = File.read(Gitlab.config.gitlab['http_client']['tls_client_cert_file']) + password = Gitlab.config.gitlab['http_client']['tls_client_cert_password'] + + Gitlab::HTTP_V2::Client.pem(pem, password) + Gitlab::LegacyHTTP.pem(pem, password) +end