Some checks are pending
CI / Crawler (Python ${{ matrix.python-version }}) (3.10) (push) Waiting to run
CI / Crawler (Python ${{ matrix.python-version }}) (3.11) (push) Waiting to run
CI / API (Python 3.11) (push) Waiting to run
CI / Database migration (push) Waiting to run
CI / App web build (Node 20) (push) Waiting to run
21 lines
711 B
JavaScript
21 lines
711 B
JavaScript
const DEFAULT_API_BASE_URL = 'https://solorpower.dadot.net';
|
|
const DEFAULT_COMPANY_ID = 1;
|
|
|
|
const normalizeBaseUrl = (value) => value.replace(/\/+$/, '');
|
|
|
|
const parseCompanyId = (value) => {
|
|
const companyId = Number.parseInt(value, 10);
|
|
return Number.isInteger(companyId) && companyId > 0
|
|
? companyId
|
|
: DEFAULT_COMPANY_ID;
|
|
};
|
|
|
|
// This is the single tenant-selection boundary until the UI supports switching
|
|
// companies. Deployments can select another company without changing source.
|
|
export const appConfig = Object.freeze({
|
|
apiBaseUrl: normalizeBaseUrl(
|
|
process.env.EXPO_PUBLIC_API_BASE_URL || DEFAULT_API_BASE_URL,
|
|
),
|
|
companyId: parseCompanyId(process.env.EXPO_PUBLIC_COMPANY_ID),
|
|
});
|