1 OpenStreetMap::Application.config.after_initialize do
 
   2   if ActiveRecord::Base.connection.table_exists?(:client_applications)
 
   3     unless webmaster = User.find_by_email("webmaster@openstreetmap.org")
 
   5       webmaster.display_name = "OpenStreetMap Webmaster"
 
   6       webmaster.email = "webmaster@openstreetmap.org"
 
   7       webmaster.pass_crypt = SecureRandom.hex
 
   8       webmaster.status = "active"
 
  12     unless id = webmaster.client_applications.find_by_name("iD")
 
  13       id = webmaster.client_applications.new
 
  15       id.url = "https://<%= @site %>/"
 
  16       ClientApplication.all_permissions.each { |p| id[p] = true }
 
  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 = "https://<%= @site %>/"
 
  26       ClientApplication.all_permissions.each { |p| potlatch[p] = true }
 
  30     POTLATCH2_KEY = potlatch.key
 
  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 = "https://<%= @site %>/"
 
  36       ClientApplication.all_permissions.each { |p| website[p] = true }
 
  40     OAUTH_KEY = website.key