diff options
| author | franck cuny <franck@lumberjaph.net> | 2011-06-13 18:07:03 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2011-06-13 18:07:03 +0200 |
| commit | 32132f973eb3ca8e29d28be4e9a5bea87cb1038b (patch) | |
| tree | 1253a04df244a9698901ccf0b8f84a18bb39cea1 | |
| parent | add mongodb auth info (diff) | |
| download | stargit-32132f973eb3ca8e29d28be4e9a5bea87cb1038b.tar.gz | |
add mongodb auth.
Signed-off-by: franck cuny <franck@lumberjaph.net>
Diffstat (limited to '')
| -rw-r--r-- | lib/GitHub/Collector/Role/MongoDB.pm | 11 | ||||
| -rw-r--r-- | lib/StarGit.pm | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/GitHub/Collector/Role/MongoDB.pm b/lib/GitHub/Collector/Role/MongoDB.pm index e4cc5b1..1801e73 100644 --- a/lib/GitHub/Collector/Role/MongoDB.pm +++ b/lib/GitHub/Collector/Role/MongoDB.pm @@ -3,14 +3,21 @@ package GitHub::Collector::Role::MongoDB; use Moose::Role; use MongoDB; +has mongodb_auth => ( + is => 'ro', + isa => 'HashRef', + auto_deref => 1, + default => sub {{} }, +); + has mongodb => ( is => 'ro', isa => 'Object', lazy => 1, default => sub { my $self = shift; - my $conn = - MongoDB::Connection->new( timeout => 60000, query_timeout => 60000 ); + my $conn = MongoDB::Connection->new( + $self->mongodb_auth ); my $db = $conn->github; $self->_create_indexes($db); return $db; diff --git a/lib/StarGit.pm b/lib/StarGit.pm index 6483a73..de5926d 100644 --- a/lib/StarGit.pm +++ b/lib/StarGit.pm @@ -15,7 +15,7 @@ get '/' => sub { get '/graph/local/:name' => sub { my $name = params->{'name'}; - my $graph = StarGit::Graph->new( name => $name ); + my $graph = StarGit::Graph->new( name => $name, mongodb_auth => setting('mongodb') ); return send_error( "user " . $name . " doesn't exists", 404 ) unless $graph->exists($name); |
