const env = process.env
// 项目url 地址
var iotPlatformUrl = ''; // 第三方云平台url
var iotHost="192.168.18.139"; // 海创iot 平台 host
// iot.gkiiot.com   192.168.18.139
var flowIotUrl = '';
let iotWebSocketBaseUrl = ''
let devLiveWebSocketBaseUrl = ''
let sysWebSocket = 'ws://'
let prodApi = '/prod-api';
let wsProtocol = 'ws://';
var hrefHost = window.location.host;
let iotWebSocketAlarmBaseUrl = '';
let httpProtocol = window.location.protocol;


if (env.NODE_ENV == 'development') {
  flowIotUrl = 'http://127.0.0.1:1880/#flow/'
  iotHost = '192.168.18.139';
  hrefHost = "192.168.18.139"
} else if(env.NODE_ENV == 'production') {
  // if (hrefHost.indexOf('.gkiiot.com') >= 0) {
  //   iotHost = 'iot.gkiiot.com'
  // }
  if(httpProtocol.indexOf("https") > -1){
    sysWebSocket = 'wss://';
  }
} else if(env.NODE_ENV == 'test') {
}
iotWebSocketAlarmBaseUrl = sysWebSocket + hrefHost  + ':8899/ws/alarm/live'
sysWebSocket = sysWebSocket + hrefHost + prodApi;
iotWebSocketBaseUrl = sysWebSocket + '/ws/dev/up/'
devLiveWebSocketBaseUrl = sysWebSocket + '/ws/dev/live/'
iotPlatformUrl = 'http://' + iotHost + '/prod-api'

export {
  iotPlatformUrl,
  sysWebSocket,
  iotWebSocketBaseUrl,
  iotWebSocketAlarmBaseUrl,
  devLiveWebSocketBaseUrl
}
