@econneq/gql-auth 1.2.4 → 1.2.5

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.
Files changed (2) hide show
  1. package/dist/client.js +14 -14
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -7,18 +7,18 @@ export default async function getApolloClient(options, domain, config) {
7
7
  const isServer = typeof window === "undefined";
8
8
  const { Subdomains } = config;
9
9
  const apiKey = process.env.API_KEY || "";
10
- const protocol = process.env.NEXT_PUBLIC_PROTOCOL || process.env.PROTOCOL;
11
- const hostInt = process.env.NEXT_PUBLIC_INTERNAL_API_URL || process.env.INTERNAL_API_URL; // e.g api:8000 (docker) or 127.0.0.1:8100 (VPS host) or localhost:8001 (local host)
12
10
  const urlDomain = process.env.NEXT_PUBLIC_DOMAIN_URL || process.env.DOMAIN_URL; // e.g e-conneq.com
13
- const urlBackEnd = process.env.NEXT_PUBLIC_BACKEND_URL || process.env.BACKEND_URL; // e.g https://admin.e-conneq.com
14
- if (!protocol)
15
- throw new Error("Env (PROTOCOL) is required");
16
- if (!hostInt)
17
- throw new Error("Env (INTERNAL_API_URL) is required");
11
+ const protocol = process.env.NEXT_PUBLIC_PROTOCOL || process.env.PROTOCOL; // e.g https:// or e.g http://
12
+ const urlBackEndInt = process.env.NEXT_PUBLIC_BACKEND_INTERNAL_URL || process.env.BACKEND_INTERNAL_URL; // e.g api:8000 (docker) or 127.0.0.1:8100 (VPS host) or localhost:8001 (local host)
13
+ const urlBackEndExt = process.env.NEXT_PUBLIC_BACKEND_EXTERNAL_URL || process.env.BACKEND_EXTERNAL_URL; // e.g https://admin.e-conneq.com
18
14
  if (!urlDomain)
19
15
  throw new Error("Env (DOMAIN_URL) is required");
20
- if (!urlBackEnd)
21
- throw new Error("Env (BACKEND_URL) is required");
16
+ if (!protocol)
17
+ throw new Error("Env (PROTOCOL) is required");
18
+ if (!urlBackEndInt)
19
+ throw new Error("Env (BACKEND_INTERNAL_URL) is required");
20
+ if (!urlBackEndExt)
21
+ throw new Error("Env (BACKEND_EXTERNAL_URL) is required");
22
22
  const tenant = domain
23
23
  ? Subdomains.find((s) => s.subdomain.toLowerCase() === domain.toLowerCase())
24
24
  : null;
@@ -27,17 +27,17 @@ export default async function getApolloClient(options, domain, config) {
27
27
  const sourceHost = `${protocol}${tenant?.subdomain || "public"}.${urlDomain}`;
28
28
  if (isServer) {
29
29
  // Use the internal host for the physical connection
30
- baseUrl = `http://${hostInt}`;
30
+ baseUrl = `http://${urlBackEndInt}`;
31
31
  uri = `${baseUrl}/graphql/`;
32
32
  }
33
33
  else {
34
34
  uri = "/api/graphql";
35
35
  // Use the EXTERNAL host for the logical Identity (Host Header)
36
- baseUrl = `${urlBackEnd}`;
36
+ baseUrl = `${urlBackEndExt}`;
37
37
  }
38
- console.log("uri", uri);
39
- console.log("baseUrl", baseUrl);
40
- console.log("sourceHost", sourceHost);
38
+ console.log("g-auth uri ==============", uri);
39
+ console.log("g-auth baseUrl ==========", baseUrl);
40
+ console.log("g-auth sourceHost =======", sourceHost);
41
41
  const csrfToken = options?.csrfToken || (!isServer ? Cookies.get("csrftoken") : "");
42
42
  const headers = {
43
43
  'Content-Type': 'application/json',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@econneq/gql-auth",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",