@cocalc/server
Version:
CoCalc server functionality: functions used by either the hub and the next.js server
24 lines • 937 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const server_settings_1 = require("./server-settings");
const base_path_1 = __importDefault(require("@cocalc/backend/base-path"));
// Returns url of this site in terms of the base path (determined
// by an env variable when server starts) and the "Domain name"
// setting of site settings. This URL does NOT end in a /
async function siteURL(dns) {
if (!dns) {
dns = (await (0, server_settings_1.getServerSettings)()).dns?.toLowerCase();
}
if (!dns) {
dns = "localhost";
}
if (!dns.startsWith("http")) {
dns = "https://" + dns;
}
return `${dns}${base_path_1.default == "/" ? "" : base_path_1.default}`;
}
exports.default = siteURL;
//# sourceMappingURL=site-url.js.map