]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/web/resources/rails_port.rb
Always confgure a local storage service
[chef.git] / cookbooks / web / resources / rails_port.rb
index fe55ec34e90ae8377115b6ebb3d3a33265772034..189c01bbf7c3b6c2fbfbcdfc0e0c5ef35a90e443 100644 (file)
@@ -67,6 +67,10 @@ property :csp_enforce, [TrueClass, FalseClass], :default => false
 property :csp_report_url, String
 property :piwik_configuration, Hash
 property :trace_use_job_queue, [TrueClass, FalseClass], :default => false
 property :csp_report_url, String
 property :piwik_configuration, Hash
 property :trace_use_job_queue, [TrueClass, FalseClass], :default => false
+property :diary_feed_delay, Integer
+property :storage_configuration, Hash, :default => {}
+property :storage_service, String, :default => "local"
+property :storage_url, String
 
 action :create do
   package %W[
 
 action :create do
   package %W[
@@ -314,7 +318,10 @@ action :create do
     "totp_key",
     "csp_enforce",
     "csp_report_url",
     "totp_key",
     "csp_enforce",
     "csp_report_url",
-    "trace_use_job_queue"
+    "trace_use_job_queue",
+    "diary_feed_delay",
+    "storage_service",
+    "storage_url"
   ).reject { |_k, v| v.nil? }.merge(
     "server_protocol" => "https",
     "server_url" => new_resource.site,
   ).reject { |_k, v| v.nil? }.merge(
     "server_protocol" => "https",
     "server_url" => new_resource.site,
@@ -343,6 +350,21 @@ action :create do
     only_if { ::File.exist?("#{rails_directory}/config/settings.yml") }
   end
 
     only_if { ::File.exist?("#{rails_directory}/config/settings.yml") }
   end
 
+  storage_configuration = new_resource.storage_configuration.merge(
+    "local" => {
+      "service" => "Disk",
+      "root" => "#{rails_directory}/storage"
+    }
+  )
+
+  file "#{rails_directory}/config/storage.yml" do
+    owner new_resource.user
+    group new_resource.group
+    mode 0o664
+    content YAML.dump(storage_configuration)
+    notifies :run, "execute[#{rails_directory}/public/assets]"
+  end
+
   if new_resource.piwik_configuration
     file "#{rails_directory}/config/piwik.yml" do
       owner new_resource.user
   if new_resource.piwik_configuration
     file "#{rails_directory}/config/piwik.yml" do
       owner new_resource.user