Merge pull request #21427 from overleaf/jpa-populate-db-on-import

[web] populate db with collections on import, ahead of waitForDb() call

GitOrigin-RevId: 7eb4cd61c2052187acd9947d7060f54d9822d314
This commit is contained in:
Jakob Ackermann
2024-11-01 09:05:15 +00:00
committed by Copybot
parent 7b3e39f63f
commit a7517eefcb
75 changed files with 124 additions and 270 deletions
@@ -1,12 +1,10 @@
import {
db,
waitForDb,
READ_PREFERENCE_SECONDARY,
} from '../../app/src/infrastructure/mongodb.js'
import { hashSecret } from '../../modules/oauth2-server/app/src/SecretsHelper.js'
async function main() {
await waitForDb()
console.log('Hashing client secrets...')
await hashSecrets(db.oauthApplications, 'clientSecret')
console.log('Hashing access tokens...')
+1 -3
View File
@@ -1,11 +1,9 @@
import minimist from 'minimist'
import { waitForDb, db } from '../../app/src/infrastructure/mongodb.js'
import { db } from '../../app/src/infrastructure/mongodb.js'
import { hashSecret } from '../../modules/oauth2-server/app/src/SecretsHelper.js'
async function main() {
const opts = parseArgs()
await waitForDb()
if (opts.accessToken == null) {
console.error('Missing --token option')
process.exit(1)
@@ -1,13 +1,12 @@
import minimist from 'minimist'
import mongodb from 'mongodb-legacy'
import { waitForDb, db } from '../../app/src/infrastructure/mongodb.js'
import { db } from '../../app/src/infrastructure/mongodb.js'
import { hashSecret } from '../../modules/oauth2-server/app/src/SecretsHelper.js'
const { ObjectId } = mongodb
async function main() {
const opts = parseArgs()
await waitForDb()
const application = await getApplication(opts.id)
if (application == null) {
console.log(
@@ -1,13 +1,11 @@
import minimist from 'minimist'
import {
waitForDb,
db,
READ_PREFERENCE_SECONDARY,
} from '../../app/src/infrastructure/mongodb.js'
async function main() {
const opts = parseArgs()
await waitForDb()
const application = await getApplication(opts.clientId)
if (application == null) {
console.error(`Client configuration not found: ${opts.clientId}`)