Setting Proxy details in google-cloud-cpp without environment variables

73 views Asked by At

I am using the google-cloud-cpp storage library to make requests.

My storage client is created:

auto service_creds = google::cloud::MakeServiceAccountCredentials(service_acc_file);
client = std::make_unique<gcs::Client>(google::cloud::Options{}.set<google::cloud::UnifiedCredentialsOption>(service_creds);

I am unable to set Proxy details with environment variables as there are other processes within the same environment that this would mess with.

Is there another way to specify Proxy details just for the storage client created without environment variables?

Ideally I could pass proxy details to the client constructor:

ClientConfiguration client_config;
client_config.proxyHost = ...;
client_config.proxyPort = ...;

client = std::make_unique...(client_config);
1

There are 1 answers

2
coryan On BEST ANSWER

Is there another way to specify Proxy details just for the storage client created without environment variables?

Not at the moment. I just created https://github.com/googleapis/google-cloud-cpp/issues/12764 as a feature request.

I am unable to set Proxy details with environment variables as there are other processes within the same environment that this would mess with.

All operating systems I know allow you to set environment variables for a single process, without affecting any other processes. How to do this depends on the system, of course.

This is not to say that your request is invalid. There may be limits in the job scheduler, shell, launcher, or something else that makes setting environment variables per process inconvenient or impossible.