@@ -165,6 +165,7 @@ void GenerateScaffold(
165165 {" BUILD.bazel" , GenerateBuild},
166166 {" CMakeLists.txt" , GenerateCMakeLists},
167167 {" doc/main.dox" , GenerateDoxygenMainPage},
168+ {" doc/environment-variables.dox" , GenerateDoxygenEnvironmentPage},
168169 {" doc/options.dox" , GenerateDoxygenOptionsPage},
169170 {" quickstart/README.md" , GenerateQuickstartReadme},
170171 {" quickstart/quickstart.cc" , GenerateQuickstartSkeleton},
@@ -582,29 +583,6 @@ which should give you a taste of the $title$ C++ client library API.
582583
583584@snippet quickstart.cc all
584585
585- ## Environment Variables
586-
587- <!-- inject-endpoint-env-vars-start -->
588- <!-- inject-endpoint-env-vars-end -->
589-
590- - `GOOGLE_CLOUD_CPP_ENABLE_TRACING=rpc` turns on tracing for most gRPC
591- calls. The library injects an additional Stub decorator that prints each gRPC
592- request and response. Unless you have configured your own logging backend,
593- you should also set `GOOGLE_CLOUD_CPP_ENABLE_CLOG` to produce any output on
594- the program's console.
595-
596- - `GOOGLE_CLOUD_CPP_ENABLE_TRACING=rpc-streams` turns on tracing for streaming
597- gRPC calls. This can produce a lot of output, so use with caution!
598-
599- - `GOOGLE_CLOUD_CPP_TRACING_OPTIONS=...` modifies the behavior of gRPC tracing,
600- including whether messages will be output on multiple lines, or whether
601- string/bytes fields will be truncated.
602-
603- - `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` turns on logging in the library. Basically
604- the library always "logs" but the logging infrastructure has no backend to
605- actually print anything until the application sets a backend or it sets this
606- environment variable.
607-
608586## Error Handling
609587
610588[status-or-header]: https://github.com/googleapis/google-cloud-cpp/blob/main/google/cloud/status_or.h
@@ -676,6 +654,58 @@ can override the default policies.
676654 printer.Print (variables, kText );
677655}
678656
657+ void GenerateDoxygenEnvironmentPage (
658+ std::ostream& os, std::map<std::string, std::string> const & variables) {
659+ auto constexpr kText = R"""( /*!
660+
661+ @page $library$-env Environment Variables
662+
663+ A number of environment variables can be used to configure the behavior of
664+ the library. There are also functions to configure this behavior in code. The
665+ environment variables are convenient when troubleshooting problems.
666+
667+ @section $library$-env-endpoint Endpoint Overrides
668+ <!-- inject-endpoint-env-vars-start -->
669+ <!-- inject-endpoint-env-vars-end -->
670+
671+ @see google::cloud::EndpointOption
672+
673+ @section $library$-env-logging Logging
674+
675+ `GOOGLE_CLOUD_CPP_ENABLE_TRACING=rpc`: turns on tracing for most gRPC
676+ calls. The library injects an additional Stub decorator that prints each gRPC
677+ request and response. Unless you have configured your own logging backend,
678+ you should also set `GOOGLE_CLOUD_CPP_ENABLE_CLOG` to produce any output on
679+ the program's console.
680+
681+ @see google::cloud::TracingComponentsOption
682+
683+ `GOOGLE_CLOUD_CPP_TRACING_OPTIONS=...`: modifies the behavior of gRPC tracing,
684+ including whether messages will be output on multiple lines, or whether
685+ string/bytes fields will be truncated.
686+
687+ @see google::cloud::TracingOptionsOption
688+
689+ `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes`: turns on logging in the library, basically
690+ the library always "logs" but the logging infrastructure has no backend to
691+ actually print anything until the application sets a backend or they set this
692+ environment variable.
693+
694+ @see google::cloud::LogBackend
695+ @see google::cloud::LogSink
696+
697+ @section $library$-env-project Setting the Default Project
698+
699+ `GOOGLE_CLOUD_PROJECT=...`: is used in examples and integration tests to
700+ configure the GCP project. This has no effect in the library.
701+
702+ */
703+ )""" ;
704+ google::protobuf::io::OstreamOutputStream output (&os);
705+ google::protobuf::io::Printer printer (&output, ' $' );
706+ printer.Print (variables, kText );
707+ }
708+
679709void GenerateDoxygenOptionsPage (
680710 std::ostream& os, std::map<std::string, std::string> const & variables) {
681711 auto constexpr kText = R"""( /*!
0 commit comments