Merge branch 'master' into staging
This commit is contained in:
commit
0866376af6
10
app.yaml
10
app.yaml
|
@ -3,8 +3,12 @@ env: flex
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
cpu: 1
|
cpu: 1
|
||||||
memory_gb: 0.5
|
memory_gb: 1
|
||||||
disk_size_gb: 10
|
disk_size_gb: 10
|
||||||
|
|
||||||
health_check:
|
liveness_check:
|
||||||
enable_health_check: False
|
path: "/"
|
||||||
|
check_interval_sec: 30
|
||||||
|
timeout_sec: 4
|
||||||
|
failure_threshold: 2
|
||||||
|
success_threshold: 2
|
||||||
|
|
|
@ -94,26 +94,24 @@ function searchEntries(tarballStream, entryName, wantsIndex) {
|
||||||
|
|
||||||
const chunks = [];
|
const chunks = [];
|
||||||
|
|
||||||
stream
|
stream.on('data', chunk => chunks.push(chunk)).on('end', () => {
|
||||||
.on('data', chunk => chunks.push(chunk))
|
const content = Buffer.concat(chunks);
|
||||||
.on('end', () => {
|
|
||||||
const content = Buffer.concat(chunks);
|
|
||||||
|
|
||||||
// Set some extra properties for files that we will
|
// Set some extra properties for files that we will
|
||||||
// need to serve them and for ?meta listings.
|
// need to serve them and for ?meta listings.
|
||||||
entry.contentType = getContentType(entry.name);
|
entry.contentType = getContentType(entry.name);
|
||||||
entry.integrity = getIntegrity(content);
|
entry.integrity = getIntegrity(content);
|
||||||
entry.lastModified = header.mtime.toUTCString();
|
entry.lastModified = header.mtime.toUTCString();
|
||||||
entry.size = content.length;
|
entry.size = content.length;
|
||||||
|
|
||||||
// Set the content only for the foundEntry and
|
// Set the content only for the foundEntry and
|
||||||
// discard the buffer for all others.
|
// discard the buffer for all others.
|
||||||
if (entry === foundEntry) {
|
if (entry === foundEntry) {
|
||||||
entry.content = content;
|
entry.content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -139,6 +137,10 @@ export default function findFile(req, res, next) {
|
||||||
if (!foundEntry) {
|
if (!foundEntry) {
|
||||||
return res
|
return res
|
||||||
.status(404)
|
.status(404)
|
||||||
|
.set({
|
||||||
|
'Cache-Control': 'public, max-age=31536000', // 1 year
|
||||||
|
'Cache-Tag': 'missing, missing-entry'
|
||||||
|
})
|
||||||
.type('text')
|
.type('text')
|
||||||
.send(`Cannot find "${req.filename}" in ${req.packageSpec}`);
|
.send(`Cannot find "${req.filename}" in ${req.packageSpec}`);
|
||||||
}
|
}
|
||||||
|
@ -158,6 +160,10 @@ export default function findFile(req, res, next) {
|
||||||
} else {
|
} else {
|
||||||
return res
|
return res
|
||||||
.status(404)
|
.status(404)
|
||||||
|
.set({
|
||||||
|
'Cache-Control': 'public, max-age=31536000', // 1 year
|
||||||
|
'Cache-Tag': 'missing, missing-index'
|
||||||
|
})
|
||||||
.type('text')
|
.type('text')
|
||||||
.send(
|
.send(
|
||||||
`Cannot find an index in "${req.filename}" in ${
|
`Cannot find an index in "${req.filename}" in ${
|
||||||
|
|
Loading…
Reference in New Issue