export let host = 'http://zhihui.xiaojukeji.com'
export let hostPre = 'http://zhihui-pre.intra.xiaojukeji.com'
export let hostTest = 'http://zhihui-test.intra.xiaojukeji.com'

export let loginUrl = host + '/sso/login?jumpto=' + 'http://zhihui-test.intra.xiaojukeji.com' + location.pathname
export let logoutUrl = host + '/sso/logout?jumpto=' + 'http://zhihui-test.intra.xiaojukeji.com' + location.pathname


export function getEnv() {
  let env = 'test'
  if (location.host.indexOf('localhost') < 0) {
    host = 'http://' + location.host
    // requestIp = host + '/zuul'
    loginUrl = host + '/sso/login?jumpto=' + location.href
    logoutUrl = host + '/sso/logout?jumpto=' + location.href
    if (host.indexOf('zhihui-pre.intra.xiaojukeji.com') >= 0) {
      env = 'pre'
    } else if (host.indexOf('zhihui.xiaojukeji.com') >= 0) {
      env = 'online'
    }
  }
  return env
}

export const requestIp =
  getEnv() === 'test' ?
    hostTest + '/zuul'
    :
    getEnv() === 'pre' ?
      hostPre + '/zuul'
      :
      host + '/zuul';

export const projectManagement = requestIp + '/project-management'
export const envManagement = requestIp + '/zhihui-env'
// export const httpMock = requestIp + '/mock' // mock


