Skip to content

Commit

Permalink
feat: add repo interoperability
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Cervello authored Oct 29, 2021
2 parents d2aff77 + 292eaa2 commit 48522db
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PRODUCT_OPENER_FLAVOR_SHORT=off
POSTGRES_USER=productopener
POSTGRES_PASSWORD=productopener
MONGODB_CACHE_SIZE=8 # GB
ROBOTOFF_URL=
ROBOTOFF_URL=http://host.docker.internal:5500 # connect to Robotoff running in separate docker-compose deployment
GOOGLE_CLOUD_VISION_API_KEY=
CROWDIN_PROJECT_IDENTIFIER=
CROWDIN_PROJECT_KEY=
Expand Down
2 changes: 2 additions & 0 deletions docker/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ services:
image: mongo:4.4
networks:
- webnet
ports:
- 27017:27017
volumes:
product_images:
html_data:
Expand Down
2 changes: 1 addition & 1 deletion lib/ProductOpener/Config2_docker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ my $po_domain = $ENV{PRODUCT_OPENER_DOMAIN};
my $po_port = $ENV{PRODUCT_OPENER_PORT};
my $is_localhost = index($po_domain, 'localhost') != -1;

$server_domain = $is_localhost ? "$po_domain:$po_port" : $po_domain;
$server_domain = $is_localhost && $po_port != '80' ? "$po_domain:$po_port" : $po_domain;
@ssl_subdomains = $is_localhost ? qw() : qw(*);
$producers_platform = $ENV{PRODUCERS_PLATFORM} || "0";

Expand Down
6 changes: 4 additions & 2 deletions lib/ProductOpener/Products.pm
Original file line number Diff line number Diff line change
Expand Up @@ -704,16 +704,18 @@ sub send_notification_for_product_change($$) {

my $product_ref = shift;
my $action = shift;

if ((defined $robotoff_url) and (length($robotoff_url) > 0)) {
my $ua = LWP::UserAgent->new();
my $endpoint = "$robotoff_url/api/v1/webhook/product";
$ua->timeout(2);

my $response = $ua->post( "$robotoff_url/api/v1/webhook/product", {
$log->debug("send_notif_robotoff_product_update", { endpoint => $endpoint, barcode => $product_ref->{code}, action => $action, server_domain => "api." . $server_domain }) if $log->is_debug();
my $response = $ua->post($endpoint, {
'barcode' => $product_ref->{code},
'action' => $action,
'server_domain' => "api." . $server_domain
} );
$log->debug("send_notif_robotoff_product_update", { endpoint => $endpoint, is_success => $response->is_success, code => $response->code, status_line => $response->status_line }) if $log->is_debug();
}

return;
Expand Down

0 comments on commit 48522db

Please sign in to comment.