diff --git a/exporters/otlp/src/otlp_grpc_client.cc b/exporters/otlp/src/otlp_grpc_client.cc index 35f5efb53e..2b2ae88685 100644 --- a/exporters/otlp/src/otlp_grpc_client.cc +++ b/exporters/otlp/src/otlp_grpc_client.cc @@ -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; @@ -68,18 +70,16 @@ std::shared_ptr 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);