const env = process.env
// 项目url 地址
var iotPlatformUrl = ''; // 第三方云平台ur
// iot.gkiiot.com   192.168.18.139
var flowIotUrl = '';
let iotWebSocketBaseUrl = ''
let devLiveWebSocketBaseUrl = ''
let sysWebSocket = 'ws://'
let prodApi = window.dasConfig.ip || '/prod-api';
let wsProtocol = 'ws://';
let iotWebSocketAlarmBaseUrl = ''

window.dasConfig = {
  ip: 'http://192.168.10.241:32024'
}

// 手动配置的地址
var iotHost="192.168.10.241:32024"; // 海创iot 平台 host
var hrefHost = window.location.host;
// let httpProtocol = window.location.protocol;
var hrefHost = '192.168.18.139';
let httpProtocol = 'http';


if (env.NODE_ENV == 'development') {
  flowIotUrl = 'http://127.0.0.1:1880/#flow/'
  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://';
  }
  if (window.dasConfig.ip) {
    hrefHost = window.dasConfig.ip
  }
} 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 + prodApi

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