2021-07-07 05:38:56 -04:00
|
|
|
const Settings = require('@overleaf/settings')
|
2021-04-27 10:17:39 -04:00
|
|
|
const logger = require('logger-sharelatex')
|
2019-05-29 05:21:06 -04:00
|
|
|
|
2021-04-27 10:17:39 -04:00
|
|
|
function ensurePlansAreSetupCorrectly() {
|
|
|
|
Settings.plans.forEach(plan => {
|
|
|
|
if (typeof plan.price !== 'number') {
|
|
|
|
logger.fatal({ plan }, 'missing price on plan')
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function findLocalPlanInSettings(planCode) {
|
2021-05-05 09:05:04 -04:00
|
|
|
for (const plan of Settings.plans) {
|
2021-04-27 10:17:39 -04:00
|
|
|
if (plan.planCode === planCode) {
|
|
|
|
return plan
|
2019-05-29 05:21:06 -04:00
|
|
|
}
|
2021-04-27 10:17:39 -04:00
|
|
|
}
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
ensurePlansAreSetupCorrectly,
|
|
|
|
findLocalPlanInSettings,
|
2019-05-29 05:21:06 -04:00
|
|
|
}
|