@rpcbase/client 0.58.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base_url.js +3 -4
- package/package.json +1 -1
package/base_url.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
import axios from "axios"
|
|
3
3
|
|
|
4
|
-
import {SERVER_PORT,
|
|
4
|
+
import {SERVER_PORT, APP_DOMAIN} from "env"
|
|
5
5
|
|
|
6
6
|
const protocol = (typeof window !== "undefined" && window?.location?.protocol) || "http:"
|
|
7
7
|
|
|
8
8
|
// there is no SERVER_PORT in production, as we use the default port and we are behind the gateway
|
|
9
9
|
// we assume we specify the port only when localhost or 127.0.0.1
|
|
10
|
-
const is_local = ["localhost", "127.0.0.1"].includes(
|
|
10
|
+
const is_local = ["localhost", "127.0.0.1"].includes(APP_DOMAIN)
|
|
11
11
|
|
|
12
|
-
const BASE_URL = is_local ? `${protocol}//${
|
|
12
|
+
const BASE_URL = is_local ? `${protocol}//${APP_DOMAIN}:${SERVER_PORT}` : `https://${APP_DOMAIN}`
|
|
13
13
|
|
|
14
|
-
console.log("HOST", HOSTNAME, BASE_URL)
|
|
15
14
|
|
|
16
15
|
export default BASE_URL
|