Small config reorganization
authorVincent Tondellier <tonton+hg@team1664.org>
Sat, 12 Dec 2015 15:55:55 +0100
changeset 79 4ae8bb6f8a96
parent 78 0ebef32c34af
child 80 d33b5f6e0862
Small config reorganization
crash_test.conf
lib/CrashTest.pm
lib/CrashTest/Model/CrashProcessor.pm
--- a/crash_test.conf	Wed Nov 04 17:43:00 2015 +0100
+++ b/crash_test.conf	Sat Dec 12 15:55:55 2015 +0100
@@ -1,15 +1,15 @@
 {
   Processor => {
-    Common => {
-      JobQueue => {
-        Backend => {
-          Minion => { Pg => "postgresql:///crashtest" },
-        },
+    JobQueue => {
+      Backend => {
+        Minion => { Pg => "postgresql:///crashtest" },
       },
     },
-    Breakpad => {
-      JSONStackwalker => 'stackwalker',
-      SymbolsPath => 'data/breakpad-debug-symbols/*',
+    CrashProcessor => {
+      Breakpad => {
+        JSONStackwalker => 'stackwalker',
+        SymbolsPath => 'data/breakpad-debug-symbols/*',
+      },
     },
   },
   Storage => [
--- a/lib/CrashTest.pm	Wed Nov 04 17:43:00 2015 +0100
+++ b/lib/CrashTest.pm	Sat Dec 12 15:55:55 2015 +0100
@@ -35,7 +35,7 @@
     $self->helper(stackfilter       => sub { state $crash_reports   = CrashTest::Model::StackFilter->new    (app => $self, config => $self->config); });
     $self->helper(storage           => sub { state $storage         = CrashTest::Model::Storage->new        (app => $self, config => $self->config); });
 
-    $self->plugin('Minion', $self->config->{Processor}->{Common}->{JobQueue}->{Backend}->{Minion});
+    $self->plugin('Minion', $self->config->{Processor}->{JobQueue}->{Backend}->{Minion});
 
     $self->storage->load_plugins();
     $self->crash_processor->load_plugins();
--- a/lib/CrashTest/Model/CrashProcessor.pm	Wed Nov 04 17:43:00 2015 +0100
+++ b/lib/CrashTest/Model/CrashProcessor.pm	Sat Dec 12 15:55:55 2015 +0100
@@ -28,7 +28,7 @@
 sub load_plugins {
     my ($self) = @_;
 
-    my @conf_processors = grep(!/^Common$/, keys %{$self->config->{Processor}});
+    my @conf_processors = keys %{$self->config->{Processor}->{CrashProcessor}};
     for my $module (@conf_processors) {
         $self->app->plugin('CrashTest::Plugin::CrashProcessor::' . $module, {
                 config => $self->config,
@@ -53,7 +53,7 @@
 sub decode {
     my ($self, $task_name, $req) = @_;
 
-    my $tmpdir = $self->config->{Processor}->{Common}->{TmpDir};
+    my $tmpdir = $self->config->{Processor}->{TmpDir};
 
     my $files;
     foreach my $up_name(map { $_->name } @{$req->uploads}) {