]> git.openstreetmap.org Git - chef.git/commitdiff
Set SECRET_KEY_BASE when delivering messages from email
authorTom Hughes <tom@compton.nu>
Mon, 13 Nov 2023 18:57:13 +0000 (18:57 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 13 Nov 2023 18:57:13 +0000 (18:57 +0000)
cookbooks/web/recipes/frontend.rb
cookbooks/web/templates/default/deliver-message.erb [new file with mode: 0644]
roles/web-frontend.rb

index 63dabd9c0fbe34bd7c2cac3c857d9fcdb8e569cb..f27b029c93fa8df76ec5278656ca899c982a5073 100644 (file)
@@ -98,3 +98,11 @@ else
     subscribes :restart, "systemd_service[rails-jobs@]"
   end
 end
+
+template "/usr/local/bin/deliver-message" do
+  source "deliver-message.erb"
+  owner "rails"
+  group "rails"
+  mode "0700"
+  variables :secret_key_base => web_passwords["secret_key_base"]
+end
diff --git a/cookbooks/web/templates/default/deliver-message.erb b/cookbooks/web/templates/default/deliver-message.erb
new file mode 100644 (file)
index 0000000..7653818
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+export RAILS_ENV="production"
+export SECRET_KEY_BASE="<%= @secret_key_base %>"
+
+exec /usr/local/bin/passenger-ruby /srv/www.openstreetmap.org/rails/script/deliver-message "$@"
index 264f2a4d2634b91d49f1c9aa9cc11e8d78c7bf09..985811f59b972d45ffef1bf0067ff712f5d51c99 100644 (file)
@@ -33,14 +33,11 @@ default_attributes(
       :messages => {
         :comment => "messages.openstreetmap.org",
         :domains => ["messages.openstreetmap.org"],
-        :command => "/usr/local/bin/passenger-ruby /srv/www.openstreetmap.org/rails/script/deliver-message $local_part",
+        :command => "/usr/local/bin/deliver-message $local_part",
         :user => "rails",
         :group => "rails",
         :home_directory => "/srv/www.openstreetmap.org/rails",
-        :path => "/bin:/usr/bin:/usr/local/bin",
-        :environment => {
-          "RAILS_ENV" => "production"
-        }
+        :path => "/bin:/usr/bin:/usr/local/bin"
       }
     }
   }