Skip to content

Commit

Permalink
Using channelFactory from API witj TLS mTLS
Browse files Browse the repository at this point in the history
  • Loading branch information
ddiakiteaneo committed Nov 12, 2024
1 parent 6c649f5 commit e3cd779
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions ArmoniK.SDK.Client/src/ChannelPool.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "ChannelPool.h"

#include <armonik/client/channel/ChannelFactory.h>
#include <armonik/common/options/ControlPlane.h>
#include <armonik/common/utils/ChannelArguments.h>
#include <grpcpp/create_channel.h>
Expand Down Expand Up @@ -28,16 +29,11 @@ std::shared_ptr<grpc::Channel> ChannelPool::AcquireChannel() {
return channel;
}
}
std::string endpoint(properties_.configuration.get_control_plane().getEndpoint());
auto scheme_delim = endpoint.find("://");
if (scheme_delim != std::string::npos) {
endpoint = endpoint.substr(scheme_delim + 3);
}
// TODO Handle TLS/mTLS
channel = grpc::CreateCustomChannel(
endpoint, grpc::InsecureChannelCredentials(),
armonik::api::common::utils::getChannelArguments(
static_cast<armonik::api::common::utils::Configuration>(properties_.configuration)));
armonik::api::common::logger::Logger logger{armonik::api::common::logger::writer_console(),
armonik::api::common::logger::formatter_plain(true)};
armonik::api::client::ChannelFactory channelFactory(
static_cast<armonik::api::common::utils::Configuration>(properties_.configuration), logger);
channel = channelFactory.create_channel();
logger_.log(armonik::api::common::logger::Level::Debug, "Created and acquired new channel from pool");
return channel;
}
Expand Down

0 comments on commit e3cd779

Please sign in to comment.