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

@ -131,7 +131,7 @@ module Api
def amf_handle_error_with_timeout(call, rootobj, rootid)
amf_handle_error(call, rootobj, rootid) do
OSM::Timer.timeout(API_TIMEOUT, OSM::APITimeoutError) do
OSM::Timer.timeout(Settings.api_timeout, OSM::APITimeoutError) do
yield
end
end

View file

@ -30,11 +30,11 @@ module Api
return
end
nodes = Node.bbox(bbox).where(:visible => true).includes(:node_tags).limit(MAX_NUMBER_OF_NODES + 1)
nodes = Node.bbox(bbox).where(:visible => true).includes(:node_tags).limit(Settings.max_number_of_nodes + 1)
node_ids = nodes.collect(&:id)
if node_ids.length > MAX_NUMBER_OF_NODES
report_error("You requested too many nodes (limit is #{MAX_NUMBER_OF_NODES}). Either request a smaller area, or use planet.osm")
if node_ids.length > Settings.max_number_of_nodes
report_error("You requested too many nodes (limit is #{Settings.max_number_of_nodes}). Either request a smaller area, or use planet.osm")
return
end

View file

@ -37,7 +37,7 @@ module Api
bbox.check_boundaries
# Check the the bounding box is not too big
bbox.check_size(MAX_NOTE_REQUEST_AREA)
bbox.check_size(Settings.max_note_request_area)
# Find the notes we want to return
@notes = notes.bbox(bbox).order("updated_at DESC").limit(result_limit).preload(:comments)
@ -190,7 +190,7 @@ module Api
bbox = BoundingBox.from_bbox_params(params)
bbox.check_boundaries
bbox.check_size(MAX_NOTE_REQUEST_AREA)
bbox.check_size(Settings.max_note_request_area)
notes = notes.bbox(bbox)
end

View file

@ -19,7 +19,7 @@ module Api
return
end
offset = page * TRACEPOINTS_PER_PAGE
offset = page * Settings.tracepoints_per_page
# Figure out the bbox
# check boundary is sane and area within defined
@ -36,7 +36,7 @@ module Api
# get all the points
ordered_points = Tracepoint.bbox(bbox).joins(:trace).where(:gpx_files => { :visibility => %w[trackable identifiable] }).order("gpx_id DESC, trackid ASC, timestamp ASC")
unordered_points = Tracepoint.bbox(bbox).joins(:trace).where(:gpx_files => { :visibility => %w[public private] }).order("gps_points.latitude", "gps_points.longitude", "gps_points.timestamp")
points = ordered_points.union_all(unordered_points).offset(offset).limit(TRACEPOINTS_PER_PAGE)
points = ordered_points.union_all(unordered_points).offset(offset).limit(Settings.tracepoints_per_page)
doc = XML::Document.new
doc.encoding = XML::Encoding::UTF_8