Allow local DFC import in development

This commit is contained in:
Maikel Linke
2024-03-13 15:09:47 +11:00
parent 30e8f9eb28
commit d6da52929f

View File

@@ -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