Skip to content

Commit

Permalink
Apply clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
kylepl committed Jun 23, 2023
1 parent 3df0faa commit b764668
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions exporters/otlp/src/otlp_grpc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ static std::string GetFileContents(const char *fpath)
}

// If the file path is non-empty, returns the contents of the file. Otherwise returns contents.
static std::string GetFileContentsOrInMemoryContents(
const std::string& file_path, const std::string& contents) {
if (!file_path.empty()) {
static std::string GetFileContentsOrInMemoryContents(const std::string &file_path,
const std::string &contents)
{
if (!file_path.empty())
{
return GetFileContents(file_path.c_str());
}
return contents;
Expand Down Expand Up @@ -68,18 +70,16 @@ std::shared_ptr<grpc::Channel> OtlpGrpcClient::MakeChannel(const OtlpGrpcExporte
grpc::ChannelArguments grpc_arguments;
grpc_arguments.SetUserAgentPrefix(options.user_agent);

if (options.use_ssl_credentials) {
if (options.use_ssl_credentials)
{
grpc::SslCredentialsOptions ssl_opts;
ssl_opts.pem_root_certs = GetFileContentsOrInMemoryContents(
options.ssl_credentials_cacert_path,
options.ssl_credentials_cacert_as_string);
options.ssl_credentials_cacert_path, options.ssl_credentials_cacert_as_string);
#if ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW
ssl_opts.pem_private_key = GetFileContentsOrInMemoryContents(
options.ssl_client_key_path,
options.ssl_client_key_string);
ssl_opts.pem_cert_chain = GetFileContentsOrInMemoryContents(
options.ssl_client_cert_path,
options.ssl_client_cert_string);
ssl_opts.pem_private_key = GetFileContentsOrInMemoryContents(options.ssl_client_key_path,
options.ssl_client_key_string);
ssl_opts.pem_cert_chain = GetFileContentsOrInMemoryContents(options.ssl_client_cert_path,
options.ssl_client_cert_string);
#endif
channel =
grpc::CreateCustomChannel(grpc_target, grpc::SslCredentials(ssl_opts), grpc_arguments);
Expand Down

0 comments on commit b764668

Please sign in to comment.