2019-05-29 05:21:06 -04:00
|
|
|
const Settings = require('settings-sharelatex')
|
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) {
|
|
|
|
for (let plan of Settings.plans) {
|
|
|
|
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
|
|
|
}
|