+ settings = new_resource.to_hash.transform_keys(&:to_s).slice(
+ "email_from",
+ "status",
+ "messages_domain",
+ "attachments_dir",
+ "log_path",
+ "logstash_path",
+ "potlatch2_key",
+ "id_key",
+ "id_application",
+ "oauth_key",
+ "oauth_application",
+ "nominatim_url",
+ "overpass_url",
+ "overpass_credentials",
+ "google_auth_id",
+ "google_auth_secret",
+ "google_openid_realm",
+ "facebook_auth_id",
+ "facebook_auth_secret",
+ "microsoft_auth_id",
+ "microsoft_auth_secret",
+ "github_auth_id",
+ "github_auth_secret",
+ "wikipedia_auth_id",
+ "wikipedia_auth_secret",
+ "thunderforest_key",
+ "tracestrack_key",
+ "totp_key",
+ "csp_enforce",
+ "csp_report_url",
+ "trace_use_job_queue",
+ "diary_feed_delay",
+ "storage_service",
+ "storage_url",
+ "avatar_storage",
+ "trace_file_storage",
+ "trace_image_storage",
+ "trace_icon_storage",
+ "avatar_storage_url",
+ "trace_image_storage_url",
+ "trace_icon_storage_url",
+ "tile_cdn_url",
+ "imagery_blacklist",
+ "signup_ip_per_day",
+ "signup_ip_max_burst",
+ "signup_email_per_day",
+ "signup_email_max_burst",
+ "doorkeeper_signing_key",
+ "user_account_deletion_delay"
+ ).compact.merge(
+ "server_protocol" => "https",
+ "server_url" => new_resource.site,
+ "support_email" => "support@openstreetmap.org",
+ "email_return_path" => "bounces@openstreetmap.org",
+ "geonames_username" => "openstreetmap",
+ "maxmind_database" => "#{node[:geoipupdate][:directory]}/GeoLite2-Country.mmdb",
+ "max_request_area" => node[:web][:max_request_area],
+ "max_number_of_nodes" => node[:web][:max_number_of_nodes],
+ "max_number_of_way_nodes" => node[:web][:max_number_of_way_nodes],
+ "max_number_of_relation_members" => node[:web][:max_number_of_relation_members],
+ "oauth_10_support" => false,
+ "oauth_10_registration" => false,
+ "oauth_10a_support" => false,
+ "basic_auth_support" => false
+ )
+
+ if new_resource.memcache_servers
+ settings["memcache_servers"] = new_resource.memcache_servers.to_a
+ end
+
+ if new_resource.gpx_dir
+ settings["gpx_trace_dir"] = "#{new_resource.gpx_dir}/traces"
+ settings["gpx_image_dir"] = "#{new_resource.gpx_dir}/images"
+ end
+
+ if new_resource.matomo_configuration
+ settings["matomo"] = new_resource.matomo_configuration.to_h
+ end
+
+ file "#{rails_directory}/config/settings.local.yml" do
+ owner new_resource.user
+ group new_resource.group
+ mode "664"
+ content YAML.dump(settings)
+ 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 "664"
+ content YAML.dump(storage_configuration)
+ end
+
+ file "#{rails_directory}/config/piwik.yml" do
+ action :delete
+ end
+
+ bundle_install "#{rails_directory}" do