use .env to configure endpoint root automatically for production and development

This commit is contained in:
Rick Watson 2018-09-14 15:40:46 +01:00
parent 17102bf867
commit d2847be8a1
3 changed files with 12 additions and 12 deletions

View File

@ -0,0 +1 @@
REACT_APP_ENDPOINT_ROOT=http://developer.openobjects.com:8080/ds5-services/endpoint/esp8266/esp8266/esp8266/

View File

@ -0,0 +1 @@
REACT_APP_ENDPOINT_ROOT=/rest/

View File

@ -1,13 +1,11 @@
const ENDPOINT_HOST = "http://192.168.0.20"; const ENDPOINT_ROOT = process.env.REACT_APP_ENDPOINT_ROOT;
const ENDPOINT_PATH = "/rest";
const ENDPOINT_PREFIX = ENDPOINT_HOST + ENDPOINT_PATH;
export const NTP_STATUS_ENDPOINT = ENDPOINT_PREFIX + "/ntpStatus"; export const NTP_STATUS_ENDPOINT = ENDPOINT_ROOT + "ntpStatus";
export const NTP_SETTINGS_ENDPOINT = ENDPOINT_PREFIX + "/ntpSettings"; export const NTP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "ntpSettings";
export const AP_SETTINGS_ENDPOINT = ENDPOINT_PREFIX + "/apSettings"; export const AP_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "apSettings";
export const AP_STATUS_ENDPOINT = ENDPOINT_PREFIX + "/apStatus"; export const AP_STATUS_ENDPOINT = ENDPOINT_ROOT + "apStatus";
export const SCAN_NETWORKS_ENDPOINT = ENDPOINT_PREFIX + "/scanNetworks"; export const SCAN_NETWORKS_ENDPOINT = ENDPOINT_ROOT + "scanNetworks";
export const LIST_NETWORKS_ENDPOINT = ENDPOINT_PREFIX + "/listNetworks"; export const LIST_NETWORKS_ENDPOINT = ENDPOINT_ROOT + "listNetworks";
export const WIFI_SETTINGS_ENDPOINT = ENDPOINT_PREFIX + "/wifiSettings"; export const WIFI_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "wifiSettings";
export const WIFI_STATUS_ENDPOINT = ENDPOINT_PREFIX + "/wifiStatus"; export const WIFI_STATUS_ENDPOINT = ENDPOINT_ROOT + "wifiStatus";
export const OTA_SETTINGS_ENDPOINT = ENDPOINT_PREFIX + "/otaSettings"; export const OTA_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "otaSettings";