Move note query limit values to settings

This commit is contained in:
Anton Khorev 2023-08-19 05:06:00 +03:00
parent 9790d779f4
commit bc9f081841
2 changed files with 7 additions and 3 deletions

View file

@ -345,13 +345,13 @@ module Api
# Get the maximum number of results to return
def result_limit
if params[:limit]
if params[:limit].to_i.positive? && params[:limit].to_i <= 10000
if params[:limit].to_i.positive? && params[:limit].to_i <= Settings.max_note_query_limit
params[:limit].to_i
else
raise OSM::APIBadUserInput, "Note limit must be between 1 and 10000"
raise OSM::APIBadUserInput, "Note limit must be between 1 and #{Settings.max_note_query_limit}"
end
else
100
Settings.default_note_query_limit
end
end

View file

@ -39,6 +39,10 @@ max_number_of_way_nodes: 2000
max_number_of_relation_members: 32000
# The maximum area you're allowed to request notes from, in square degrees
max_note_request_area: 25
# Default limit on the number of notes returned by the note search api method
default_note_query_limit: 100
# Maximum limit on the number of notes returned by the note search api method
max_note_query_limit: 10000
# Zoom level to use for postcode results from the geocoder
postcode_zoom: 15
# Timeout for API calls in seconds