summaryrefslogtreecommitdiff
path: root/src/buildtool/common/remote/client_common.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-01 17:07:02 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-04 16:05:08 +0200
commit0d60cd9ba4a5c18b01b6ef996434953071f0576e (patch)
treee2d96536db33b8e36cfc417e548d0f60b2d1ed28 /src/buildtool/common/remote/client_common.hpp
parent217e31bf00c3437658033bd0829f31929f10a103 (diff)
downloadjustbuild-0d60cd9ba4a5c18b01b6ef996434953071f0576e.tar.gz
Pass Auth::TLS instance to serve and execute clients
Diffstat (limited to 'src/buildtool/common/remote/client_common.hpp')
-rw-r--r--src/buildtool/common/remote/client_common.hpp11
1 files changed, 5 insertions, 6 deletions
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<grpc::ChannelCredentials> 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 {