@@ -63,8 +63,9 @@ std::unordered_set<Endpoint> GetDefaultEndpoints() {
6363}
6464
6565// / \brief Fetch server config and merge it with client config
66- Result<CatalogConfig> FetchServerConfig (const std::string& config_path ,
66+ Result<CatalogConfig> FetchServerConfig (const ResourcePaths& paths ,
6767 const RestCatalogProperties& current_config) {
68+ ICEBERG_ASSIGN_OR_RAISE (auto config_path, paths.Config ());
6869 HttpClient client (current_config.ExtractHeaders ());
6970 ICEBERG_ASSIGN_OR_RAISE (const auto response,
7071 client.Get (config_path, /* params=*/ {}, /* headers=*/ {},
@@ -110,9 +111,10 @@ Result<std::shared_ptr<RestCatalog>> RestCatalog::Make(
110111 if (!file_io) {
111112 return InvalidArgument (" FileIO is required to create RestCatalog" );
112113 }
113- ICEBERG_ASSIGN_OR_RAISE (auto config_uri,
114- ResourcePaths::Config (std::string (TrimTrailingSlash (uri))));
115- ICEBERG_ASSIGN_OR_RAISE (auto server_config, FetchServerConfig (config_uri, config));
114+ ICEBERG_ASSIGN_OR_RAISE (
115+ auto paths, ResourcePaths::Make (std::string (TrimTrailingSlash (uri)),
116+ config.Get (RestCatalogProperties::kPrefix )));
117+ ICEBERG_ASSIGN_OR_RAISE (auto server_config, FetchServerConfig (*paths, config));
116118
117119 std::unique_ptr<RestCatalogProperties> final_config = RestCatalogProperties::FromMap (
118120 MergeConfigs (server_config.defaults , config.configs (), server_config.overrides ));
@@ -131,7 +133,7 @@ Result<std::shared_ptr<RestCatalog>> RestCatalog::Make(
131133 // Update resource paths based on the final config
132134 ICEBERG_ASSIGN_OR_RAISE (auto final_uri, final_config->Uri ());
133135 ICEBERG_ASSIGN_OR_RAISE (
134- auto paths, ResourcePaths::Make (std::string (TrimTrailingSlash (final_uri)),
136+ paths, ResourcePaths::Make (std::string (TrimTrailingSlash (final_uri)),
135137 final_config->Get (RestCatalogProperties::kPrefix )));
136138
137139 return std::shared_ptr<RestCatalog>(
0 commit comments