19 lines
677 B
JavaScript
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 }; |