Browse Source

Add Sidekiq Web UI that's locked down to admins only. Fixes #9

Chris Oliver 7 years ago
parent
commit
bf13e22158
1 changed files with 8 additions and 0 deletions
  1. 8 0
      template.rb

+ 8 - 0
template.rb

@@ -59,6 +59,14 @@ end
 
 def add_sidekiq
   environment "config.active_job.queue_adapter = :sidekiq"
+
+  insert_into_file "config/routes.rb",
+    "require 'sidekiq/web'\n\n",
+    before: "Rails.application.routes.draw do"
+
+  insert_into_file "config/routes.rb",
+    "  authenticate :user, lambda { |u| u.admin? } do\n    mount Sidekiq::Web => '/sidekiq'\n  end\n\n",
+    after: "Rails.application.routes.draw do\n"
 end
 
 def add_foreman