New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make the API item limit configurable #1543
Conversation
c345342
to
19c4125
Compare
Use API_ITEM_LIMIT environment variable to set the upper limit on the number of items to return for API requests to a Supermarket instance. Defaults to the previously hard-coded value of 100 if the env var is not present. Also, the cookbook internal to the omnibus package has the same default set in the section of the attributes that get set as env vars. Signed-off-by: Robb Kidd <rkidd@chef.io>
19c4125
to
53d1afa
Compare
@@ -46,7 +46,7 @@ def error(body, status = 400) | |||
# | |||
def init_params | |||
@start = params.fetch(:start, 0).to_i | |||
@items = [params.fetch(:items, 10).to_i, 100].min | |||
@items = [params.fetch(:items, 10).to_i, item_limit].min |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a part of me that thinks that the API should respond with a 4xx error when an API request has an item
value greater than the limit. Then the requestor would get a clear "no soup for you" message instead of wondering why their request did not return their desired number of items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed but can happen after we release. Can you open an issue for that before this gets released?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #1544 to return an error when an item count is requested greater than the item limit.
Submitting to the pipeline for a build to test further. |
Use
API_ITEM_LIMIT
environment variable to set the upper limit on the number of items to return for API requests to a Supermarket instance.Defaults to the previously hard-coded value of 100 if the env var is not present. Also, the cookbook internal to the omnibus package has the same default set in the section of the attributes that get set as env vars.
Closes #1542