aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Chen Wang <chen.wang.github@gmail.com>2015-01-27 18:38:10 -0800
committerGravatar Chen Wang <chen.wang.github@gmail.com>2015-01-27 18:38:10 -0800
commitf6f3ea91996a30e28cca35391b4d47851b79a21c (patch)
treecdbb635e3d12a7fc74a658d34f4c374d0d4b8629
parent4d9f3d7b6337880ff1bb72de91e1421589f09582 (diff)
parent56794708d2cf9dc5dec3e5662aa7114a43a4ccdf (diff)
Merge pull request #255 from chen-wang/master
add Compute engine credential to tips client.
-rw-r--r--examples/tips/client_main.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/tips/client_main.cc b/examples/tips/client_main.cc
index f4a3b09601..23cabd1554 100644
--- a/examples/tips/client_main.cc
+++ b/examples/tips/client_main.cc
@@ -36,6 +36,7 @@
#include <google/gflags.h>
#include <grpc++/channel_interface.h>
#include <grpc++/create_channel.h>
+#include <grpc++/credentials.h>
#include <grpc++/status.h>
#include "examples/tips/client.h"
@@ -55,11 +56,15 @@ int main(int argc, char** argv) {
snprintf(host_port, host_port_buf_size, "%s:%d", FLAGS_server_host.c_str(),
FLAGS_server_port);
+ std::unique_ptr<grpc::Credentials> creds =
+ grpc::CredentialsFactory::ComputeEngineCredentials();
std::shared_ptr<grpc::ChannelInterface> channel(
- grpc::CreateTestChannel(host_port,
- FLAGS_server_host,
- true, // enable SSL
- true)); // use prod roots
+ grpc::CreateTestChannel(
+ host_port,
+ FLAGS_server_host,
+ true, // enable SSL
+ true, // use prod roots
+ creds));
grpc::examples::tips::Client client(channel);
grpc::Status s = client.CreateTopic("test");