// // // Copyright 2019 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // #ifndef GRPC_SRC_CORE_LIB_GPRPP_GLOBAL_CONFIG_ENV_H #define GRPC_SRC_CORE_LIB_GPRPP_GLOBAL_CONFIG_ENV_H #include <grpc/support/port_platform.h> #include <stdint.h> #include "src/core/lib/gprpp/global_config_generic.h" // IWYU pragma: export #include "src/core/lib/gprpp/memory.h" namespace grpc_core { GlobalConfigEnvErrorFunctionType; // // Set global_config_env_error_function which is called when config system // encounters errors such as parsing error. What the default function does // is logging error message. // void SetGlobalConfigEnvErrorFunction(GlobalConfigEnvErrorFunctionType func); // Base class for all classes to access environment variables. class GlobalConfigEnv { … }; class GlobalConfigEnvBool : public GlobalConfigEnv { … }; class GlobalConfigEnvInt32 : public GlobalConfigEnv { … }; class GlobalConfigEnvString : public GlobalConfigEnv { … }; } // namespace grpc_core // Macros for defining global config instances using environment variables. // This defines a GlobalConfig*Type* instance with arguments for // mutable variable name and default value. // Mutable name (g_env_str_##name) is here for having an array // for the canonical name without dynamic allocation. // `help` argument is ignored for this implementation. #define GPR_GLOBAL_CONFIG_DEFINE_BOOL(name, default_value, help) … #define GPR_GLOBAL_CONFIG_DEFINE_INT32(name, default_value, help) … #define GPR_GLOBAL_CONFIG_DEFINE_STRING(name, default_value, help) … #endif // GRPC_SRC_CORE_LIB_GPRPP_GLOBAL_CONFIG_ENV_H