Files
arrr-erp-test-v2/fixtures/url.js
T
2026-06-26 20:38:14 +05:30

27 lines
575 B
JavaScript

require('dotenv').config();
const DEFAULT_BASE_URL = 'https://erp-test.vavalam.com';
function normalizeBaseURL(value) {
const raw = (value || '').trim() || DEFAULT_BASE_URL;
return raw.replace(/\/+$/, '');
}
const BASE_URL = normalizeBaseURL(
process.env.BASE_URL ||
process.env.APP_BASE_URL ||
process.env.PLAYWRIGHT_BASE_URL ||
DEFAULT_BASE_URL
);
function absoluteUrl(route = '/') {
if (/^https?:\/\//i.test(route)) return route;
return new URL(route, `${BASE_URL}/`).toString();
}
module.exports = {
BASE_URL,
DEFAULT_BASE_URL,
absoluteUrl,
};