Files
sap-erp/services/companyConfig.js
T
John 69b4e68baf
SAP-ERP Portal CI/CD / build (push) Failing after 5m20s
first commit
2026-09-23 17:31:02 +05:30

19 lines
677 B
JavaScript

'use strict';
// Single source of truth for the default SAP B1 company/schema — read from
// .env (SAP_B1_COMPANY). Every service/route/page must resolve it through
// this module rather than hardcoding the company code.
const DEFAULT_COMPANY = process.env.SAP_B1_COMPANY;
if (!DEFAULT_COMPANY) {
console.error('[companyConfig] FATAL: SAP_B1_COMPANY is not set in .env — cannot start.');
process.exit(1);
}
const COMPANIES = {
[DEFAULT_COMPANY]: { display: 'MIPL', short: 'MIPL' },
};
function isValid(c) { return !!COMPANIES[c]; }
function resolve(c) { return isValid(c) ? c : DEFAULT_COMPANY; }
module.exports = { COMPANIES, DEFAULT_COMPANY, isValid, resolve };