@yobytechautomation/config-lib 0.1.3 → 0.1.4
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.
|
@@ -57,4 +57,24 @@ export interface BaseConfigService {
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* 🔥 NEW: BASE IMPLEMENTATION (LICENSE CONTROL HERE)
|
|
62
|
+
*/
|
|
63
|
+
export declare abstract class BaseConfigServiceImpl implements BaseConfigService {
|
|
64
|
+
protected env: Record<string, any>;
|
|
65
|
+
constructor();
|
|
66
|
+
private validateLicense;
|
|
67
|
+
abstract getDatabaseConfig(): TypeOrmModuleOptions;
|
|
68
|
+
abstract getPort(): number;
|
|
69
|
+
abstract getMode(): string;
|
|
70
|
+
abstract getConsulConfig(): any;
|
|
71
|
+
abstract getRedisConfig(): any;
|
|
72
|
+
abstract getJWTConfig(): any;
|
|
73
|
+
abstract getJUtilConfig(): any;
|
|
74
|
+
abstract getMailConfig(): any;
|
|
75
|
+
abstract getKAFKAConfig(): any;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* TOKEN
|
|
79
|
+
*/
|
|
60
80
|
export declare const BASE_CONFIG_SERVICE: unique symbol;
|
|
@@ -1,4 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BASE_CONFIG_SERVICE = void 0;
|
|
6
|
+
exports.BASE_CONFIG_SERVICE = exports.BaseConfigServiceImpl = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
/**
|
|
9
|
+
* 🔥 NEW: BASE IMPLEMENTATION (LICENSE CONTROL HERE)
|
|
10
|
+
*/
|
|
11
|
+
class BaseConfigServiceImpl {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.env = process.env;
|
|
14
|
+
this.validateLicense(); // 🔥 IMPORTANT
|
|
15
|
+
}
|
|
16
|
+
async validateLicense() {
|
|
17
|
+
try {
|
|
18
|
+
const apiKey = this.env.LICENSE_KEY;
|
|
19
|
+
if (!apiKey) {
|
|
20
|
+
throw new Error('LICENSE_KEY missing');
|
|
21
|
+
}
|
|
22
|
+
const res = await axios_1.default.get('http://localhost:3000/license/check', {
|
|
23
|
+
headers: {
|
|
24
|
+
'x-api-key': apiKey,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
if (res.data.status !== 'active') {
|
|
28
|
+
throw new Error('License invalid');
|
|
29
|
+
}
|
|
30
|
+
console.log('✅ License validated');
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
console.error('❌ LICENSE ERROR:', err.message);
|
|
34
|
+
process.exit(1); // 🚨 STOP APPLICATION
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.BaseConfigServiceImpl = BaseConfigServiceImpl;
|
|
39
|
+
/**
|
|
40
|
+
* TOKEN
|
|
41
|
+
*/
|
|
4
42
|
exports.BASE_CONFIG_SERVICE = Symbol('BASE_CONFIG_SERVICE');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yobytechautomation/config-lib",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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",
|
|
@@ -27,5 +27,8 @@
|
|
|
27
27
|
"@types/node": "^24.10.1",
|
|
28
28
|
"rimraf": "^6.0.0",
|
|
29
29
|
"typescript": "^5.0.0"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"axios": "^1.13.6"
|
|
30
33
|
}
|
|
31
34
|
}
|