3.15.0-rc 3.14.2-rc 3.13.0 (latest) 3.12.0 3.11.0 3.10.0 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.0 2.48.0-rc 2.47.1 2.46.0 2.45.0 2.44.0 2.43.0 2.42.0 2.41.0 2.40.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.0 2.28.0 2.27.0 2.26.0 2.25.1 2.24.0 2.23.0 2.22.1 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.0 2.15.1 2.14.0 2.13.0 2.12.0 2.11.0 A number of environment variables can be used to configure the behavior of the library. There are also functions to configure this behavior in code. The environment variables are convenient when troubleshooting problems.

## Setting the Default Project

Some of the GCS APIs need a [project](https://cloud.google.com/storage/docs/projects) as a parameter. For such APIs the application can (a) call an overload that takes the project id as a parameter, (b) define the project explicitly when the `Client` object is constructed, or (c) set the `GOOGLE_CLOUD_PROJECT` environment variable to the desired project id. If you have set this environment variable the code can be even simpler:

```cpp
  namespace gcs = ::google::cloud::storage;
  using ::google::cloud::StatusOr;
  [](gcs::Client client, std::string const& bucket_name) {
    StatusOr<gcs::BucketMetadata> bucket_metadata =
        client.CreateBucket(bucket_name, gcs::BucketMetadata());
    if (!bucket_metadata) throw std::move(bucket_metadata).status();

    std::cout << "Bucket " << bucket_metadata->name() << " created."
              << "\nFull Metadata: " << *bucket_metadata << "\n";
  }
```

###### See Also

[`google::cloud::storage::ProjectIdOption`](https://docs.cloud.google.com/cpp/docs/reference/storage/latest/structgoogle_1_1cloud_1_1storage_1_1ProjectIdOption.md.txt)

## Endpoint Overrides

`CLOUD_STORAGE_EMULATOR_ENDPOINT=...`: override the default endpoint used by the library. Intended for testing only. Unless the application configures [`google::cloud::UnifiedCredentialsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1UnifiedCredentialsOption.md.txt), a [`google::cloud::storage::Client`](https://docs.cloud.google.com/cpp/docs/reference/storage/latest/classgoogle_1_1cloud_1_1storage_1_1Client.md.txt) created with this variable set uses insecure (anonymous) credentials, as the emulator does not support authentication. This variable does not change the gRPC endpoint or credentials used by [`google::cloud::storage::MakeGrpcClient()`](https://docs.cloud.google.com/cpp/docs/reference/storage/latest/namespacegoogle_1_1cloud_1_1storage.md.txt) or [`google::cloud::storage::AsyncClient`](https://docs.cloud.google.com/cpp/docs/reference/storage/latest/classgoogle_1_1cloud_1_1storage_1_1AsyncClient.md.txt).

`CLOUD_STORAGE_TESTBENCH_ENDPOINT=...`: **DEPRECATED** please use `CLOUD_STORAGE_EMULATOR_ENDPOINT` instead.

###### See Also

[`google::cloud::storage::RestEndpointOption`](https://docs.cloud.google.com/cpp/docs/reference/storage/latest/structgoogle_1_1cloud_1_1storage_1_1RestEndpointOption.md.txt)

###### See Also

[`google::cloud::storage::IamEndpointOption`](https://docs.cloud.google.com/cpp/docs/reference/storage/latest/structgoogle_1_1cloud_1_1storage_1_1IamEndpointOption.md.txt)

## Enabling Experimental Behaviors

`GOOGLE_CLOUD_CPP_STORAGE_REST_CONFIG=...`: configuration for the REST protocol, but currently unused.

`GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG=...`: this is deprecated.

`GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS_OVER_INTERCONNECT=true`: attempt DirectPath over [Cloud Interconnect](https://cloud.google.com/network-connectivity/docs/interconnect). This bypasses the usual GCE environment detection, making DirectPath usable from on-premise hosts. Requires gRPC 1.85.0 or later; when compiled against an older version, the client logs a warning and falls back to the standard endpoint defaults. Set it to `true` to enable the feature. Set it to `false` to disable the feature even when the corresponding option is enabled in code. Only these exact values are recognized, and the comparison is case-sensitive; any other value, such as `1` or `TRUE`, is treated as if the variable were not set. This environment variable takes precedence over the option.

###### See Also

[`google::cloud::storage_experimental::DirectPathXdsOverInterconnectOption`](https://docs.cloud.google.com/cpp/docs/reference/storage/latest/structgoogle_1_1cloud_1_1storage__experimental_1_1DirectPathXdsOverInterconnectOption.md.txt)`GCP_STORAGE_CPP_ENABLE_OTEL_METRICS=true`: enable OpenTelemetry client metrics collection for Storage. Set it to `true` to enable metrics collection, or to `false` to disable it even when the corresponding option is enabled in code. Only these exact values are recognized, and the comparison is case-sensitive; any other value, such as `1` or `TRUE`, is treated as if the variable were not set. This environment variable takes precedence over the option.

###### See Also

[`google::cloud::storage_experimental::EnableOTelMetricsOption`](https://docs.cloud.google.com/cpp/docs/reference/storage/latest/structgoogle_1_1cloud_1_1storage__experimental_1_1EnableOTelMetricsOption.md.txt)`GCP_STORAGE_CPP_ENABLE_OTEL_DEBUG_METRICS=true`: enable OpenTelemetry debug client metrics collection for Storage. This is independent of `GCP_STORAGE_CPP_ENABLE_OTEL_METRICS` and can be enabled on its own or alongside standard metrics. Set it to `true` to enable debug metrics collection, or to `false` to disable it even when the corresponding option is enabled in code. Only these exact values are recognized, and the comparison is case-sensitive; any other value, such as `1` or `TRUE`, is treated as if the variable were not set. This environment variable takes precedence over the option.

###### See Also

[`google::cloud::storage_experimental::EnableOTelDebugMetricsOption`](https://docs.cloud.google.com/cpp/docs/reference/storage/latest/structgoogle_1_1cloud_1_1storage__experimental_1_1EnableOTelDebugMetricsOption.md.txt)
Interconnect'

## Logging

`CLOUD_STORAGE_ENABLE_TRACING=raw-client`: enables logging for each "RPC" generated by the library. Unless you have configured your own logging backend, you should also set `GOOGLE_CLOUD_CPP_ENABLE_CLOG` to produce any output on the program's console.

`CLOUD_STORAGE_ENABLE_TRACING=http`: enables logging for the full http traffic generated by the library.

`CLOUD_STORAGE_ENABLE_TRACING=raw-client,http`: enables all logging.

###### See Also

[`google::cloud::GrpcTracingOptionsOption`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1GrpcTracingOptionsOption.md.txt)`GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes`: turns on logging in the library, basically the library always "logs" but the logging infrastructure has no backend to actually print anything until the application sets a backend or they set this environment variable.

###### See Also

[`google::cloud::LogBackend`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1LogBackend.md.txt)

###### See Also

[`google::cloud::LogSink`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1LogSink.md.txt)