mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-09 00:59:02 +02:00
Merge pull request #12121 from overleaf/bg-fix-bad-offsets-in-history-migration
fix out of range offsets to avoid invalid history exports GitOrigin-RevId: d00e3e9e08feb6c3be671b5805102a66782b3f92
This commit is contained in:
@@ -2,6 +2,25 @@
|
||||
process.env.MONGO_SOCKET_TIMEOUT =
|
||||
parseInt(process.env.MONGO_SOCKET_TIMEOUT, 10) || 3600000
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
if (fs.existsSync('/etc/container_environment.json')) {
|
||||
try {
|
||||
const envData = JSON.parse(
|
||||
fs.readFileSync('/etc/container_environment.json', 'utf8')
|
||||
)
|
||||
for (const [key, value] of Object.entries(envData)) {
|
||||
process.env[key] = value
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(
|
||||
'cannot read /etc/container_environment.json, the script needs to be run as root',
|
||||
err
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
const VERSION = '0.9.0-cli'
|
||||
const {
|
||||
countProjects,
|
||||
@@ -11,7 +30,6 @@ const {
|
||||
} = require('../../modules/history-migration/app/src/HistoryUpgradeHelper')
|
||||
const { waitForDb } = require('../../app/src/infrastructure/mongodb')
|
||||
const minimist = require('minimist')
|
||||
const fs = require('fs')
|
||||
const util = require('util')
|
||||
const pLimit = require('p-limit')
|
||||
const logger = require('@overleaf/logger')
|
||||
@@ -34,6 +52,7 @@ const argv = minimist(process.argv.slice(2), {
|
||||
'use-query-hint',
|
||||
'retry-failed',
|
||||
'archive-on-failure',
|
||||
'force-clean',
|
||||
],
|
||||
string: ['output', 'user-id'],
|
||||
alias: {
|
||||
@@ -168,6 +187,7 @@ async function migrateProjects(projectsToMigrate) {
|
||||
convertLargeDocsToFile: argv['convert-large-docs-to-file'],
|
||||
userId: argv['user-id'],
|
||||
reason: VERSION,
|
||||
forceClean: argv['force-clean'],
|
||||
}
|
||||
async function _migrateProject(project) {
|
||||
if (INTERRUPT) {
|
||||
|
||||
Reference in New Issue
Block a user