"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getServerDomain = getServerDomain;
exports.getServerUrl = getServerUrl;

function getServerDomain(serverInfo) {
  const {
    host,
    domain,
    k8s
  } = serverInfo;

  if (domain && !k8s) {
    return `${host}.${domain}.zohocorpin.com`;
  }

  return host;
}

function getServerUrl({
  domain,
  k8s,
  port,
  protocol = 'http'
}) {
  const prefix = protocol ? `${protocol}:` : '';

  if (k8s) {
    return `${prefix}//${domain}`;
  }

  return `${prefix}//${domain}:${port}/`;
}