@onlineapps/infrastructure-tools 1.0.16 → 1.0.18

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": "@onlineapps/infrastructure-tools",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Infrastructure orchestration utilities for OA Drive infrastructure services (health tracking, queue initialization, service discovery)",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  "author": "OnlineApps",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@onlineapps/mq-client-core": "^1.0.37",
21
+ "@onlineapps/mq-client-core": "^1.0.38",
22
22
  "@onlineapps/service-common": "^1.0.1",
23
23
  "uuid": "^9.0.1"
24
24
  },
@@ -56,6 +56,11 @@ function createHealthPublisher(options) {
56
56
 
57
57
  const queueName = config.queueName || config.infrastructureHealth?.queueName || process.env.INFRASTRUCTURE_HEALTH_QUEUE || 'infrastructure.health.checks';
58
58
  const publishInterval = config.publishInterval || config.infrastructureHealth?.publishInterval || parseInt(process.env.INFRASTRUCTURE_HEALTH_PUBLISH_INTERVAL) || 5000;
59
+
60
+ // Support for disabling health checks via environment variable (useful for library updates)
61
+ const healthChecksDisabled = process.env.DISABLE_HEALTH_CHECKS === 'true' ||
62
+ process.env.DISABLE_HEALTH_CHECKS === '1' ||
63
+ config.disableHealthChecks === true;
59
64
 
60
65
  /**
61
66
  * Publish health check to infrastructure.health.checks queue
@@ -125,11 +130,25 @@ function createHealthPublisher(options) {
125
130
  return;
126
131
  }
127
132
 
133
+ // Check if health checks are disabled (useful for library updates/maintenance)
134
+ if (healthChecksDisabled) {
135
+ logger.warn(`[InfrastructureHealth:${serviceName}] Health checks are disabled (DISABLE_HEALTH_CHECKS=true). Skipping start.`, {
136
+ reason: 'health_checks_disabled',
137
+ serviceName
138
+ });
139
+ return;
140
+ }
141
+
128
142
  // Publish initial health check immediately
129
143
  await publishHealthCheck();
130
144
 
131
145
  // Then publish periodically
132
146
  healthCheckInterval = setInterval(() => {
147
+ // Double-check disabled flag on each interval (allows runtime changes)
148
+ if (healthChecksDisabled) {
149
+ stop();
150
+ return;
151
+ }
133
152
  publishHealthCheck().catch(err => {
134
153
  logger.error(`[InfrastructureHealth:${serviceName}] Error in health check publisher interval`, {
135
154
  error: err.message
@@ -166,7 +185,8 @@ function createHealthPublisher(options) {
166
185
  start,
167
186
  stop,
168
187
  publishNow,
169
- isRunning: () => healthCheckInterval !== null
188
+ isRunning: () => healthCheckInterval !== null,
189
+ isDisabled: () => healthChecksDisabled
170
190
  };
171
191
  }
172
192