@yobytechautomation/config-lib 0.1.6 → 0.1.8

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.
@@ -40,7 +40,6 @@ exports.BASE_CONFIG_SERVICE = exports.BaseConfigServiceImpl = void 0;
40
40
  const axios_1 = __importDefault(require("axios"));
41
41
  const dotenv = __importStar(require("dotenv"));
42
42
  // 🔥 LOAD ENV FILE FIRST (VERY IMPORTANT)
43
- // dotenv.config();
44
43
  dotenv.config({ path: process.env.ENV_FILE || '.env.local' });
45
44
  /**
46
45
  * 🔥 BASE IMPLEMENTATION (LICENSE CONTROL)
@@ -52,23 +51,34 @@ class BaseConfigServiceImpl {
52
51
  this.validateLicense();
53
52
  }
54
53
  async validateLicense() {
54
+ var _a;
55
55
  try {
56
56
  const apiKey = this.env.LICENSE_KEY;
57
57
  if (!apiKey) {
58
58
  throw new Error('LICENSE_KEY missing');
59
59
  }
60
- const res = await axios_1.default.get('http://localhost:3000/license/check', {
60
+ // 🔥 ENCODED URL (hidden)
61
+ const part1 = 'aHR0cHM6Ly9kZXYu';
62
+ const part2 = 'd2F0ZXJhdXRvLnlvYnl0ZWNo';
63
+ const part3 = 'LmluL2xpY2Vuc2UvY2hlY2s=';
64
+ const url = Buffer.from(part1 + part2 + part3, 'base64').toString('utf-8');
65
+ // 🔥 SECRET (can also obfuscate later)
66
+ const secret = 'my_super_secret_123';
67
+ const res = await axios_1.default.get(url, {
61
68
  headers: {
62
69
  'x-api-key': apiKey,
70
+ 'x-license-secret': secret,
63
71
  },
72
+ timeout: 5000, // prevent hanging
64
73
  });
65
- if (res.data.status !== 'active') {
66
- throw new Error('License invalid');
74
+ const status = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.status;
75
+ if (status !== 'active') {
76
+ throw new Error(`License ${status}`);
67
77
  }
68
78
  console.log('✅ License validated');
69
79
  }
70
80
  catch (err) {
71
- console.error('❌ LICENSE ERROR:', err.message);
81
+ console.error('❌ LICENSE ERROR:', (err === null || err === void 0 ? void 0 : err.message) || err);
72
82
  process.exit(1);
73
83
  }
74
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yobytechautomation/config-lib",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Shared multi-environment configuration helpers for SDC NestJS services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",