Provide a way to easily test the implementation.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2021-07-08 19:26:37 +02:00
parent 8b653ba877
commit fd00a11bb4
@@ -246,6 +246,28 @@ export async function createRouter(
}
});
/**
* TODO: Remove this endpoint before merging. This is just a convenient way
* to test publisher.migrateDocsCase() implementations.
*/
router.get('/do-not-commit/migrate', async (req, res) => {
if (publisher.migrateDocsCase) {
try {
await publisher.migrateDocsCase({
// removeOriginal: !!req.query?.removeOriginal,
concurrency:
parseInt((req.query?.concurrency as string) || '', 10) || undefined,
});
res.status(200).send('Good job');
} catch (e) {
logger.error(e);
res.status(500).send('Uh-oh');
}
} else {
res.status(400).send('Not valid');
}
});
// Route middleware which serves files from the storage set in the publisher.
router.use('/static/docs', publisher.docsRouter());