xtra-cli 0.1.8 → 0.1.9

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.
@@ -5,15 +5,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getProjectConfig = exports.getAuthToken = exports.clearConfig = exports.setConfig = exports.getConfigValue = exports.getConfig = void 0;
7
7
  const conf_1 = __importDefault(require("conf"));
8
+ const PRODUCTION_API_URL = "https://xtra-security.vercel.app/api";
8
9
  const config = new conf_1.default({
9
10
  projectName: "xtra-cli",
10
11
  defaults: {
11
- apiUrl: "https://xtra-security.vercel.app/api", // Default to production
12
+ apiUrl: PRODUCTION_API_URL,
12
13
  },
13
14
  });
15
+ // Auto-heal: if an old localhost value was persisted, clear it so we use production.
16
+ // Users who intentionally want localhost should set XTRA_API_URL env var instead.
17
+ const _storedApiUrl = config.get("apiUrl");
18
+ if (_storedApiUrl && _storedApiUrl.includes("localhost") && !process.env.XTRA_API_URL) {
19
+ config.set("apiUrl", PRODUCTION_API_URL);
20
+ }
14
21
  const getConfig = () => ({
15
22
  ...config.store,
16
- apiUrl: process.env.XTRA_API_URL || config.get("apiUrl") || "https://xtra-security.vercel.app/api"
23
+ apiUrl: process.env.XTRA_API_URL || config.get("apiUrl") || PRODUCTION_API_URL
17
24
  });
18
25
  exports.getConfig = getConfig;
19
26
  const getConfigValue = (key) => config.get(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xtra-cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "CLI for XtraSecurity Platform",
5
5
  "main": "dist/index.js",
6
6
  "bin": {