@sanvika/geolocation 0.6.0 → 0.6.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanvika/geolocation",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Sanvika ecosystem geolocation SDK — fully centralized via geolocation.sanvikaproduction.com. IP lookup, reverse/forward geocoding, Places autocomplete + details, Maps JS loader. Zero Google API keys in consumer projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -23,12 +23,16 @@ export class GeolocationServiceClient {
|
|
|
23
23
|
#secret;
|
|
24
24
|
|
|
25
25
|
constructor({ url, clientId, serviceKey, secret } = {}) {
|
|
26
|
-
const finalUrl =
|
|
26
|
+
const finalUrl =
|
|
27
|
+
url ||
|
|
28
|
+
readEnv("GEOLOCATION_URL") ||
|
|
29
|
+
readEnv("GEO_URL") ||
|
|
30
|
+
"https://geolocation.sanvikaproduction.com";
|
|
27
31
|
const finalClientId = clientId || readEnv("CLIENT_ID") || readEnv("GEOLOCATION_CLIENT_ID");
|
|
28
32
|
const finalServiceKey = serviceKey || readEnv("SANVIKA_SERVICE_KEY") || "";
|
|
29
33
|
const finalSecret = secret || readEnv("GEOLOCATION_CLIENT_SECRET") || ""; // Tier 2 fallback (optional)
|
|
30
|
-
if (!
|
|
31
|
-
throw new Error("@sanvika/geolocation/server:
|
|
34
|
+
if (!finalClientId) {
|
|
35
|
+
throw new Error("@sanvika/geolocation/server: CLIENT_ID is required");
|
|
32
36
|
}
|
|
33
37
|
this.#url = finalUrl.replace(/\/$/, "");
|
|
34
38
|
this.#clientId = finalClientId;
|