From: Anton Khorev Date: Sat, 19 Aug 2023 02:06:00 +0000 (+0300) Subject: Move note query limit values to settings X-Git-Tag: live~1277^2~3 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/bc9f081841d43af4c3e10919a3434e3b541233a9 Move note query limit values to settings --- diff --git a/app/controllers/api/notes_controller.rb b/app/controllers/api/notes_controller.rb index 5e24532e7..83024288d 100644 --- a/app/controllers/api/notes_controller.rb +++ b/app/controllers/api/notes_controller.rb @@ -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 diff --git a/config/settings.yml b/config/settings.yml index 49b4531ad..15a5753e4 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -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