From 0d60cd9ba4a5c18b01b6ef996434953071f0576e Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 1 Jul 2024 17:07:02 +0200 Subject: Pass Auth::TLS instance to serve and execute clients --- src/buildtool/common/remote/client_common.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/buildtool/common/remote/client_common.hpp') diff --git a/src/buildtool/common/remote/client_common.hpp b/src/buildtool/common/remote/client_common.hpp index eb4af68f..4fd9e9a7 100644 --- a/src/buildtool/common/remote/client_common.hpp +++ b/src/buildtool/common/remote/client_common.hpp @@ -32,15 +32,14 @@ [[maybe_unused]] [[nodiscard]] static inline auto CreateChannelWithCredentials( std::string const& server, - Port port) noexcept { + Port port, + Auth::TLS const* auth) noexcept { std::shared_ptr creds; std::string address = server + ':' + std::to_string(port); - if (Auth::Instance().GetAuthMethod() == AuthMethod::kTLS) { - auto tls_opts = - grpc::SslCredentialsOptions{Auth::TLS::Instance().CACert(), - Auth::TLS::Instance().ClientKey(), - Auth::TLS::Instance().ClientCert()}; + if (auth != nullptr) { + auto tls_opts = grpc::SslCredentialsOptions{ + auth->CACert(), auth->ClientKey(), auth->ClientCert()}; creds = grpc::SslCredentials(tls_opts); } else { -- cgit v1.2.3