Move all settings to settings.yml

We leave the STATUS setting alone, since it's required before rails
boots. The test-specific settings now live in config/settings/test.yml
This commit is contained in:
Andy Allan 2019-03-13 16:38:03 +01:00
parent 7b08270526
commit d102c9aaf4
62 changed files with 316 additions and 349 deletions

View file

@ -1,20 +1,20 @@
xml.instruct! :xml, :version => "1.0"
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
osm.api do |api|
api.version(:minimum => API_VERSION.to_s, :maximum => API_VERSION.to_s)
api.area(:maximum => MAX_REQUEST_AREA.to_s)
api.note_area(:maximum => MAX_NOTE_REQUEST_AREA.to_s)
api.tracepoints(:per_page => TRACEPOINTS_PER_PAGE.to_s)
api.waynodes(:maximum => MAX_NUMBER_OF_WAY_NODES.to_s)
api.changesets(:maximum_elements => Changeset::MAX_ELEMENTS.to_s)
api.timeout(:seconds => API_TIMEOUT.to_s)
api.status(:database => @database_status.to_s,
:api => @api_status.to_s,
:gpx => @gpx_status.to_s)
api.version(:minimum => Settings.api_version, :maximum => Settings.api_version)
api.area(:maximum => Settings.max_request_area)
api.note_area(:maximum => Settings.max_note_request_area)
api.tracepoints(:per_page => Settings.tracepoints_per_page)
api.waynodes(:maximum => Settings.max_number_of_way_nodes)
api.changesets(:maximum_elements => Changeset::MAX_ELEMENTS)
api.timeout(:seconds => Settings.api_timeout)
api.status(:database => @database_status,
:api => @api_status,
:gpx => @gpx_status)
end
osm.policy do |policy|
policy.imagery do |imagery|
IMAGERY_BLACKLIST.each do |url_regex|
Settings.imagery_blacklist.each do |url_regex|
imagery.blacklist(:regex => url_regex.to_s)
end
end

View file

@ -25,8 +25,8 @@
<%= tag("meta", { :name => "msapplication-TileImage", :content => image_path("mstile-144x144.png") }) %>
<%= tag("meta", { :name => "theme-color", :content => "#ffffff" }) %>
<%= canonical_tag %>
<% if defined?(PUBLISHER_URL) -%>
<%= tag("link", { :rel => "publisher", :href => PUBLISHER_URL }) %>
<% if Settings.key?(:publisher_url) -%>
<%= tag("link", { :rel => "publisher", :href => Settings.publisher_url }) %>
<% end -%>
<%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => asset_path("osm.xml") }) %>
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>

View file

@ -1,6 +1,6 @@
<p><%= t 'notifier.email_confirm_html.greeting' %></p>
<p><%= t 'notifier.email_confirm_html.hopefully_you', :server_url => SERVER_URL, :new_address => @address %></p>
<p><%= t 'notifier.email_confirm_html.hopefully_you', :server_url => Settings.server_url, :new_address => @address %></p>
<p><%= t 'notifier.email_confirm_html.click_the_link' %></p>

View file

@ -1,6 +1,6 @@
<%= t 'notifier.email_confirm_plain.greeting' %>
<%= word_wrap(t 'notifier.email_confirm_plain.hopefully_you', :server_url => SERVER_URL, :new_address => @address) %>
<%= word_wrap(t 'notifier.email_confirm_plain.hopefully_you', :server_url => Settings.server_url, :new_address => @address) %>
<%= t 'notifier.email_confirm_plain.click_the_link' %>

View file

@ -1,6 +1,6 @@
<p><%= t(".greeting") %></p>
<p><%= t(".created", :site_url => SERVER_URL) %></p>
<p><%= t(".created", :site_url => Settings.server_url) %></p>
<p><%= t(".confirm") %></p>

View file

@ -1,6 +1,6 @@
<%= fp(t(".greeting")) %>
<%= fp(t(".created", :site_url => SERVER_URL)) %>
<%= fp(t(".created", :site_url => Settings.server_url)) %>
<%= fp(t(".confirm")) %>

View file

@ -1,7 +1,7 @@
<%= javascript_include_tag "edit/id" %>
<div id="map">
<% data = { :key => ID_KEY } -%>
<% data = { :key => Settings.id_key } -%>
<% data[:lat] = @lat if @lat -%>
<% data[:lon] = @lon if @lon -%>
<% data[:gpx] = trace_data_url(params[:gpx], :format => :xml) if params[:gpx] -%>

View file

@ -6,8 +6,8 @@
<% data[:lat] = @lat if @lat -%>
<% data[:lon] = @lon if @lon -%>
<% data[:zoom] = @zoom if @zoom -%>
<% if defined? POTLATCH2_KEY %>
<% token = current_user.access_token(POTLATCH2_KEY) %>
<% if Settings.key?(:potlatch2_key) %>
<% token = current_user.access_token(Settings.potlatch2_key) %>
<% data[:token] = token.token -%>
<% data[:token_secret] = token.secret -%>
<% data[:consumer_key] = token.client_application.key -%>

View file

@ -9,8 +9,8 @@
</head>
<body>
<% data = {} -%>
<% if defined? ID_KEY %>
<% token = current_user.access_token(ID_KEY) %>
<% if Settings.key?(:id_key) %>
<% token = current_user.access_token(Settings.id_key) %>
<% data[:token] = token.token -%>
<% data[:token_secret] = token.secret -%>
<% data[:consumer_key] = token.client_application.key -%>

View file

@ -85,7 +85,7 @@
</div>
<div class="form-row">
<label class="standard-label"><%= t '.preferred editor' %></label>
<%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{DEFAULT_EDITOR}.name")), 'default']] + Editors::ALL_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %>
<%= f.select :preferred_editor, [[t("editor.default", :name => t("editor.#{Settings.default_editor}.name")), 'default']] + Editors::ALL_EDITORS.collect { |e| [t("editor.#{e}.description"), e] } %>
</div>
</fieldset>

View file

@ -6,5 +6,5 @@
<div class="message">
<h1><%= t 'users.new.no_auto_account_create' %></h1>
<h2><%= raw t 'users.new.contact_webmaster', :webmaster => "mailto:#{SUPPORT_EMAIL}" %></h2>
<h2><%= raw t 'users.new.contact_webmaster', :webmaster => "mailto:#{Settings.support_email}" %></h2>
</div>

View file

@ -53,19 +53,19 @@
<ul class='clearfix' id="login_auth_buttons">
<li><%= link_to image_tag("openid.png", :alt => t(".auth_providers.openid.title")), "#", :id => "openid_open_url", :title => t(".auth_providers.openid.title") %></li>
<% if defined?(GOOGLE_AUTH_ID) -%>
<% if Settings.key?(:google_auth_id) -%>
<li><%= auth_button "google", "google" %></li>
<% end -%>
<% if defined?(FACEBOOK_AUTH_ID) -%>
<% if Settings.key?(:facebook_auth_id) -%>
<li><%= auth_button "facebook", "facebook" %></li>
<% end -%>
<% if defined?(WINDOWSLIVE_AUTH_ID) -%>
<% if Settings.key?(:windowslive_auth_id) -%>
<li><%= auth_button "windowslive", "windowslive" %></li>
<% end -%>
<% if defined?(GITHUB_AUTH_ID) -%>
<% if Settings.key?(:github_auth_id) -%>
<li><%= auth_button "github", "github" %></li>
<% end -%>
<% if defined?(WIKIPEDIA_AUTH_ID) -%>
<% if Settings.key?(:wikipedia_auth_id) -%>
<li><%= auth_button "wikipedia", "wikipedia" %></li>
<% end -%>
<li><%= auth_button "yahoo", "openid", :openid_url => "yahoo.com" %></li>

View file

@ -4,4 +4,4 @@
<h1><%= t ".heading" %></h1>
<% end %>
<%= raw t ".body", :webmaster => link_to(t(".webmaster"), "mailto:#{SUPPORT_EMAIL}") %>
<%= raw t ".body", :webmaster => link_to(t(".webmaster"), "mailto:#{Settings.support_email}") %>