From d6da52929f76aecee7e6ee50f80f682d3b55dfb5 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 13 Mar 2024 15:09:47 +1100 Subject: [PATCH] Allow local DFC import in development --- .../admin/dfc_product_imports_controller.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/dfc_product_imports_controller.rb b/app/controllers/admin/dfc_product_imports_controller.rb index d76e42e704..ff5386f662 100644 --- a/app/controllers/admin/dfc_product_imports_controller.rb +++ b/app/controllers/admin/dfc_product_imports_controller.rb @@ -42,13 +42,21 @@ module Admin 'Authorization' => "Bearer #{spree_current_user.oidc_account.token}", } ) - response = PrivateAddressCheck.only_public_connections do + response = only_public_connections do connection.get(url) end response.body end + def only_public_connections + return yield if Rails.env.development? + + PrivateAddressCheck.only_public_connections do + yield + end + end + # Most of this code is the same as in the DfcProvider::SuppliedProductsController. def import_product(subject, enterprise) return unless subject.is_a? DataFoodConsortium::Connector::SuppliedProduct