proxy script requests to CouchDB
[angular-mojolicious.git] / couchdb-trigger.pl
index db5acb0..2ec5705 100755 (executable)
@@ -15,7 +15,7 @@ use strict;
 
 use lib 'common/mojo/lib';
 
-use Mojo::Client;
+use Mojo::UserAgent;
 use Mojo::JSON;
 use Time::HiRes qw(time);
 use Data::Dump qw(dump);
@@ -25,12 +25,14 @@ my ( $url, $trigger_path ) = @ARGV;
 $url          ||= 'http://localhost:5984/monitor';
 $trigger_path ||= 'trigger/shell.pm' ;
 
+our $database = $1 if $url =~ m{/(\w+)/?$};
+
 sub commit { warn "# commit ignored\n"; }
 require $trigger_path if -e $trigger_path;
 
 my $seq = 0;
 
-my $client = Mojo::Client->new;
+my $client = Mojo::UserAgent->new;
 our $json   = Mojo::JSON->new;
 sub info { warn $_[0], " ",$json->encode($_[1]),$/ }
 sub debug { info "# $_[0]", $_[1] }