Skip to content

Commit c9b1609

Browse files
authored
Merge pull request #176 from camicroscope/develop
For 3.12.1
2 parents 23eab1a + 48ed2f0 commit c9b1609

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
FROM node:20-alpine
22
RUN apk add --no-cache git
33
RUN apk add --no-cache openssl
4+
RUN apk add bash
45
RUN mkdir /src
56
COPY . /src
67
WORKDIR /src

handlers/pathdbIipHandler.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,14 @@ iipCheck = function(req, res, next) {
2121
const PDB_URL = process.env.PDB_URL || 'http://quip-pathdb';
2222
let requestedNode = req.iipFileRequested.replace("pathdb*", "");
2323
let lookupUrl = PDB_URL + "/node/" + requestedNode + "?_format=json";
24-
console.log(lookupUrl);
2524
let pdbReqHeaders = {"Authorization": "Bearer " + auth.getToken(req)};
26-
console.log(pdbReqHeaders);
2725
fetch(lookupUrl, {headers: pdbReqHeaders}).then((x)=>x.json()).then((x)=>{
28-
console.log(x);
2926
// get path
3027
if (x && x['field_iip_path'] && x['field_iip_path'].length && x['field_iip_path'][0]['value']) {
3128
newFilepath = x['field_iip_path'][0]['value'];
3229
newFilepath = encodeURIComponent(newFilepath);
3330
newFilepath = newFilepath.replaceAll("%2F", "/");
3431
req.newFilepath = newFilepath;
35-
console.log(req.newFilepath);
3632
next();
3733
} else {
3834
let err = {};

service/database/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
const { getConnection } = require("./connector");
22
const { transformIdToObjectId } = require("./util");
33

4+
let maxDocsInput = process.env.MAX_NUM_FIND_DOCS;
5+
let MAX_NUM_FIND_DOCS = parseInt(maxDocsInput, 10);
6+
if (Number.isNaN(MAX_NUM_FIND_DOCS) || MAX_NUM_FIND_DOCS <= 0) {
7+
MAX_NUM_FIND_DOCS = Number.MAX_SAFE_INTEGER;
8+
}
9+
410
/**
511
* @class Mongo
612
* @description Handles database operations, called via handler. This is like a generic that
@@ -24,7 +30,7 @@ class Mongo {
2430
query = transformIdToObjectId(query);
2531

2632
const collection = getConnection(database).collection(collectionName);
27-
const data = await collection.find(query).toArray();
33+
const data = await collection.find(query).limit(MAX_NUM_FIND_DOCS).toArray();
2834

2935
/** allow caller method to toggle response transformation */
3036
if (transform) {

0 commit comments

Comments
 (0)