mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-12 11:44:01 -05:00
aa2c200200
[web] enable prettier for module scripts and ignore some more paths GitOrigin-RevId: f130e420d6fd1a85e85d994d342d49fdffca813a
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
const minimist = require('minimist')
|
|
const {
|
|
db,
|
|
ObjectId,
|
|
waitForDb,
|
|
} = require('../../../app/src/infrastructure/mongodb')
|
|
|
|
async function main() {
|
|
await waitForDb()
|
|
|
|
const argv = minimist(process.argv.slice(2), {
|
|
string: ['user-id', 'compile-timeout'],
|
|
})
|
|
|
|
const { 'user-id': userId, 'compile-timeout': rawCompileTimeout } = argv
|
|
const compileTimeout = parseInt(rawCompileTimeout, 10)
|
|
if (
|
|
!userId ||
|
|
!ObjectId.isValid(userId) ||
|
|
!rawCompileTimeout ||
|
|
Number.isNaN(compileTimeout)
|
|
) {
|
|
console.error(
|
|
`Usage: node ${__filename} --user-id=5a9414f259776c7900b300e6 --timeout=90`
|
|
)
|
|
process.exit(101)
|
|
}
|
|
|
|
if (compileTimeout < 1 || compileTimeout > 600) {
|
|
console.error(
|
|
`The compile timeout must be positive number of seconds, below 10 minutes (600).`
|
|
)
|
|
process.exit(101)
|
|
}
|
|
|
|
await db.users.updateOne(
|
|
{ _id: ObjectId(userId) },
|
|
{ $set: { 'features.compileTimeout': compileTimeout } }
|
|
)
|
|
}
|
|
|
|
main()
|
|
.then(() => {
|
|
console.error('Done.')
|
|
process.exit(0)
|
|
})
|
|
.catch(err => {
|
|
console.error(err)
|
|
process.exit(1)
|
|
})
|