]> git.openstreetmap.org Git - chef.git/blob - cookbooks/dev/templates/default/rails.setup.rb.erb
Mediawiki: increase autoblock period + spam filter regex
[chef.git] / cookbooks / dev / templates / default / rails.setup.rb.erb
1 unless Object.const_defined?(:Rake) or Object.const_defined?(:POTLATCH2_KEY)
2   OpenStreetMap::Application.config.after_initialize do
3     unless webmaster = User.find_by_email("webmaster@openstreetmap.org")
4       webmaster = User.new
5       webmaster.display_name = "OpenStreetMap Webmaster"
6       webmaster.email = "webmaster@openstreetmap.org"
7       webmaster.pass_crypt = SecureRandom.hex
8       webmaster.status = "active"
9       webmaster.save!
10     end
11
12     unless id = webmaster.client_applications.find_by_name("iD")
13       id = webmaster.client_applications.new
14       id.name = "iD"
15       id.url = "http://<%= @site %>/"
16       ClientApplication.all_permissions.each { |p| id[p] = true }
17       id.save!
18     end
19
20     ID_KEY = id.key
21
22     unless potlatch = webmaster.client_applications.find_by_name("Potlatch 2")
23       potlatch = webmaster.client_applications.new
24       potlatch.name = "Potlatch 2"
25       potlatch.url = "http://<%= @site %>/"
26       ClientApplication.all_permissions.each { |p| potlatch[p] = true }
27       potlatch.save!
28     end
29
30     POTLATCH2_KEY = potlatch.key
31
32     unless website = webmaster.client_applications.find_by_name("Web Site")
33       website = webmaster.client_applications.new
34       website.name = "Web Site"
35       website.url = "http://<%= @site %>/"
36       ClientApplication.all_permissions.each { |p| website[p] = true }
37       website.save!
38     end
39
40     OAUTH_KEY = website.key
41   end
42 end