This commit is contained in:
Dobromir Popov
2024-05-05 01:42:13 +03:00
4 changed files with 7 additions and 20 deletions

View File

@ -77,17 +77,6 @@ exports.isValidPhoneNumber = function (phone) {
// If neither condition is met, the phone number is invalid
return false;
}
exports.setBaseUrl = function (req) {
const protocol = req.headers['x-forwarded-proto'] || 'http';
const host = req.headers.host;
const baseUrl = `${protocol}://${host}`;
// Write the baseUrl to the file
if (req != null) {
fs.writeFileSync(path.join(__dirname, 'baseUrl.txt'), baseUrl, 'utf8');
}
return baseUrl;
};
exports.getBaseUrl = function (relative = "", req = null) {
return process.env.NEXT_PUBLIC_PUBLIC_URL + relative;