mirror of
https://github.com/fleetbase/fleetbase.git
synced 2026-02-24 18:07:06 +00:00
17 lines
460 B
JavaScript
17 lines
460 B
JavaScript
const toBoolean = require('./to-boolean');
|
|
|
|
// This function is a temp hotfix to patch api host
|
|
module.exports = function fixApiHost(apiHost, secure = false) {
|
|
secure = toBoolean(secure);
|
|
|
|
if (typeof apiHost === 'string' && apiHost.length > 4 && !apiHost.startsWith('http')) {
|
|
if (secure === true) {
|
|
apiHost = `https://${apiHost}`;
|
|
} else {
|
|
apiHost = `http://${apiHost}`;
|
|
}
|
|
}
|
|
|
|
return apiHost;
|
|
};
|