overleaf/services/web/app/src/Features/Subscription/PlansLocator.js
Eric Mc Sween 5fc6d7dcb3 Merge pull request #5740 from overleaf/em-gcp-logging-web
Improve GCP logging for web

GitOrigin-RevId: b304c87a3fe46c29189f665eb3daf22c23d6eb8f
2021-11-11 09:03:09 +00:00

25 lines
547 B
JavaScript

const Settings = require('@overleaf/settings')
const logger = require('@overleaf/logger')
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 (const plan of Settings.plans) {
if (plan.planCode === planCode) {
return plan
}
}
return null
}
module.exports = {
ensurePlansAreSetupCorrectly,
findLocalPlanInSettings,
}