File tree Expand file tree Collapse file tree 3 files changed +39
-3
lines changed
Expand file tree Collapse file tree 3 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ of what it's like to use one of these C++ libraries.
2828
2929``` cc
3030#include " google/cloud/storage/client.h"
31+ #include " google/cloud/common_options.h"
32+ #include < cstdlib>
3133#include < iostream>
3234#include < string>
3335
@@ -41,7 +43,17 @@ int main(int argc, char* argv[]) {
4143
4244 // Create a client to communicate with Google Cloud Storage. This client
4345 // uses the default configuration for authentication and project id.
44- auto client = google::cloud : :storage::Client();
46+ auto options = google::cloud : :Options{};
47+
48+ // If the CURL_CA_BUNDLE environment variable is set, configure the client
49+ // to use it. This is required for the Windows CI environment where standard
50+ // system roots may not be sufficient or accessible by the hermetic build.
51+ auto const* ca_bundle = std::getenv("CURL_CA_BUNDLE");
52+ if (ca_bundle != nullptr) {
53+ options.set< google::cloud::CARootsFilePathOption > (ca_bundle);
54+ }
55+
56+ auto client = google::cloud : :storage::Client(options);
4557
4658 auto writer = client.WriteObject(bucket_name, "quickstart.txt");
4759 writer << "Hello World!";
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ this library.
2222
2323``` cc
2424#include " google/cloud/storage/client.h"
25+ #include " google/cloud/common_options.h"
26+ #include < cstdlib>
2527#include < iostream>
2628#include < string>
2729
@@ -35,7 +37,17 @@ int main(int argc, char* argv[]) {
3537
3638 // Create a client to communicate with Google Cloud Storage. This client
3739 // uses the default configuration for authentication and project id.
38- auto client = google::cloud : :storage::Client();
40+ auto options = google::cloud : :Options{};
41+
42+ // If the CURL_CA_BUNDLE environment variable is set, configure the client
43+ // to use it. This is required for the Windows CI environment where standard
44+ // system roots may not be sufficient or accessible by the hermetic build.
45+ auto const* ca_bundle = std::getenv("CURL_CA_BUNDLE");
46+ if (ca_bundle != nullptr) {
47+ options.set< google::cloud::CARootsFilePathOption > (ca_bundle);
48+ }
49+
50+ auto client = google::cloud : :storage::Client(options);
3951
4052 auto writer = client.WriteObject(bucket_name, "quickstart.txt");
4153 writer << "Hello World!";
Original file line number Diff line number Diff line change 1414
1515// ! [all]
1616#include " google/cloud/storage/client.h"
17+ #include " google/cloud/common_options.h"
18+ #include < cstdlib>
1719#include < iostream>
1820#include < string>
1921
@@ -27,7 +29,17 @@ int main(int argc, char* argv[]) {
2729
2830 // Create a client to communicate with Google Cloud Storage. This client
2931 // uses the default configuration for authentication and project id.
30- auto client = google::cloud::storage::Client ();
32+ auto options = google::cloud::Options{};
33+
34+ // If the CURL_CA_BUNDLE environment variable is set, configure the client
35+ // to use it. This is required for the Windows CI environment where standard
36+ // system roots may not be sufficient or accessible by the hermetic build.
37+ auto const * ca_bundle = std::getenv (" CURL_CA_BUNDLE" );
38+ if (ca_bundle != nullptr ) {
39+ options.set <google::cloud::CARootsFilePathOption>(ca_bundle);
40+ }
41+
42+ auto client = google::cloud::storage::Client (options);
3143
3244 auto writer = client.WriteObject (bucket_name, " quickstart.txt" );
3345 writer << " Hello World!" ;
You can’t perform that action at this time.
0 commit comments