chore(api): enable exam environment endpoints in prod (#57604)

This commit is contained in:
Shaun Hamilton
2024-12-19 11:43:39 +02:00
committed by GitHub
parent 12c28755d0
commit 423db476de
2 changed files with 7 additions and 5 deletions

View File

@@ -24,7 +24,9 @@ const prisma = new PrismaClient({
/// TODO:
/// 1. Deprecate all previous generated exams for a given exam id?
async function main() {
console.info('Connecting to cluster...');
await prisma.$connect();
console.info('Connected.');
const exam = await prisma.envExam.findUnique({
where: {
@@ -38,6 +40,9 @@ async function main() {
let numberOfExamsGenerated = 0;
console.info(
`Exam with _id ${ENV_EXAM_ID} found. Generating ${NUMBER_OF_EXAMS_TO_GENERATE} exams...`
);
while (numberOfExamsGenerated < NUMBER_OF_EXAMS_TO_GENERATE) {
try {
const generatedExam = generateExam(exam);
@@ -45,10 +50,12 @@ async function main() {
data: generatedExam
});
numberOfExamsGenerated++;
console.info(`Generated ${numberOfExamsGenerated} exams`);
} catch (e) {
console.log(e);
}
}
console.log(`Finished generating exams.`);
}
void main();

View File

@@ -58,11 +58,6 @@ assert.ok(process.env.MONGOHQ_URL);
assert.ok(process.env.COOKIE_SECRET);
if (process.env.FREECODECAMP_NODE_ENV !== 'development') {
assert.notEqual(
process.env.FCC_ENABLE_EXAM_ENVIRONMENT,
'true',
'Exam environment is not ready for production.'
);
assert.ok(process.env.SES_ID);
assert.ok(process.env.SES_SECRET);
assert.notEqual(