Line data Source code
1 : #include "source/extensions/common/aws/region_provider_impl.h" 2 : 3 : namespace Envoy { 4 : namespace Extensions { 5 : namespace Common { 6 : namespace Aws { 7 : 8 : static const char AWS_REGION[] = "AWS_REGION"; 9 : 10 0 : StaticRegionProvider::StaticRegionProvider(const std::string& region) : region_(region) {} 11 : 12 0 : absl::optional<std::string> StaticRegionProvider::getRegion() { return {region_}; } 13 : 14 0 : absl::optional<std::string> EnvironmentRegionProvider::getRegion() { 15 0 : const auto region = std::getenv(AWS_REGION); 16 0 : if (region == nullptr) { 17 0 : return absl::nullopt; 18 0 : } 19 0 : ENVOY_LOG(debug, "Found environment region {}={}", AWS_REGION, region); 20 0 : return {region}; 21 0 : } 22 : 23 : } // namespace Aws 24 : } // namespace Common 25 : } // namespace Extensions 26 : } // namespace Envoy