- if new_resource.piwik_configuration
- file "#{rails_directory}/config/piwik.yml" do
- owner new_resource.user
- group new_resource.group
- mode 0o664
- content YAML.dump(new_resource.piwik_configuration)
- notifies :run, "execute[#{rails_directory}/public/assets]"
- end
- else
- file "#{rails_directory}/config/piwik.yml" do
- action :delete
- notifies :run, "execute[#{rails_directory}/public/assets]"
- end
+ file "delete:#{rails_directory}/config/application.yml" do
+ path "#{rails_directory}/config/application.yml"
+ action :delete
+ not_if { ::File.exist?("#{rails_directory}/config/example.application.yml") }
+ end
+
+ 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",
+ "windowslive_auth_id",
+ "windowslive_auth_secret",
+ "github_auth_id",
+ "github_auth_secret",
+ "wikipedia_auth_id",
+ "wikipedia_auth_secret",
+ "thunderforest_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"
+ ).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" => "/usr/share/GeoIP/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]
+ )
+
+ 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"