@onlineapps/conn-base-monitoring 1.0.2 → 1.0.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.
- package/package.json +3 -2
- package/src/config.js +31 -0
- package/src/defaults.js +15 -0
- package/src/index.js +6 -2
- package/onlineapps-conn-base-monitoring-1.0.0.tgz +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlineapps/conn-base-monitoring",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Monitoring connector for service-wrapper integration",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"test:component": "jest tests/component"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@onlineapps/monitoring-core": "1.0.
|
|
13
|
+
"@onlineapps/monitoring-core": "1.0.13",
|
|
14
|
+
"@onlineapps/runtime-config": "1.0.2"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
17
|
"jest": "^29.5.0"
|
package/src/config.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runtime configuration schema for @onlineapps/conn-base-monitoring.
|
|
5
|
+
*
|
|
6
|
+
* Uses @onlineapps/runtime-config for unified priority:
|
|
7
|
+
* 1. Explicit config (passed to init())
|
|
8
|
+
* 2. Environment variable
|
|
9
|
+
* 3. Owner defaults (from ./defaults.js)
|
|
10
|
+
*
|
|
11
|
+
* NOTE: Core monitoring defaults belong to @onlineapps/monitoring-core.
|
|
12
|
+
* This config only covers wrapper behavior (mode selection).
|
|
13
|
+
*
|
|
14
|
+
* @module @onlineapps/conn-base-monitoring/config
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const { createRuntimeConfig } = require('@onlineapps/runtime-config');
|
|
18
|
+
const DEFAULTS = require('./defaults');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Runtime config schema for MonitoringConnector
|
|
22
|
+
*/
|
|
23
|
+
const runtimeCfg = createRuntimeConfig({
|
|
24
|
+
defaults: DEFAULTS,
|
|
25
|
+
schema: {
|
|
26
|
+
mode: { env: 'MONITORING_MODE', defaultKey: 'mode' },
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
module.exports = runtimeCfg;
|
|
31
|
+
|
package/src/defaults.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Module-owned defaults for @onlineapps/conn-base-monitoring.
|
|
5
|
+
*
|
|
6
|
+
* Ownership rule:
|
|
7
|
+
* - This connector owns defaults for its wrapper behavior.
|
|
8
|
+
* - Core defaults belong to @onlineapps/monitoring-core.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
mode: 'light',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
|
package/src/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const monitoringCore = require('@onlineapps/monitoring-core');
|
|
7
|
+
const runtimeCfg = require('./config');
|
|
7
8
|
|
|
8
9
|
class MonitoringConnector {
|
|
9
10
|
constructor() {
|
|
@@ -15,9 +16,12 @@ class MonitoringConnector {
|
|
|
15
16
|
* Initialize monitoring with service defaults
|
|
16
17
|
*/
|
|
17
18
|
async init(options = {}) {
|
|
18
|
-
//
|
|
19
|
+
// Resolve runtime configuration for wrapper behavior
|
|
20
|
+
const resolved = runtimeCfg.resolve(options);
|
|
21
|
+
|
|
22
|
+
// Service-specific config
|
|
19
23
|
const config = {
|
|
20
|
-
mode:
|
|
24
|
+
mode: resolved.mode,
|
|
21
25
|
...options
|
|
22
26
|
};
|
|
23
27
|
|
|
Binary file
|