oschaaf commented on a change in pull request #1969: Integration of envoy fetcher in pagespeed URL: https://github.com/apache/incubator-pagespeed-mod/pull/1969#discussion_r357692144
########## File path: pagespeed/envoy/envoy_cluster_manager.cc ########## @@ -107,13 +109,38 @@ void EnvoyClusterManager::initClusterManager() { dispatcher_->createDnsResolver({}), *ssl_context_manager_, *dispatcher_, *local_info_, secret_manager_, validation_context_, *api_, http_context_, *access_log_manager_, *singleton_manager_); +} - Envoy::MessageUtil::loadFromFile( - "pagespeed/envoy/cluster.yaml", - bootstrap, Envoy::ProtobufMessage::getStrictValidationVisitor(), *api_); - - cluster_manager_ = cluster_manager_factory_->clusterManagerFromProto(bootstrap); +Envoy::Upstream::ClusterManager& +EnvoyClusterManager::getClusterManager(const GoogleString str_url_) { + UriImpl uri(str_url_); + try { + uri.resolve(*dispatcher_, Envoy::Network::DnsLookupFamily::Auto); + } catch (UriException) { + // TODO : Error Handling. + std::cout << "UriException \n"; + std::cout.flush(); + } + cluster_manager_ = + cluster_manager_factory_->clusterManagerFromProto(createBootstrapConfiguration(uri)); cluster_manager_->setInitializedCb([this]() -> void { init_manager_.initialize(init_watcher_); }); + return *cluster_manager_; +} + +const envoy::config::bootstrap::v2::Bootstrap +EnvoyClusterManager::createBootstrapConfiguration(const Uri& uri) const { Review comment: I guess the uri / utilities are all there just so you can pass Uri here right? Let's just remove the argument, or pass in whatever we need for the relevant lines that need it: ``` socket_address->set_address(uri.address()->ip()->addressAsString()); socket_address->set_port_value(uri.port()); ``` Probably, string address, uint32_t port or something like that suffices? I think this is going to be temporary anyway, so we might as well just remove the arguments completely, and just hard code it for now until the forward proxy cluster type is introduced. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services