freeschema 1.0.10 → 1.0.11
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/bin/freeschema.js +12 -1
- package/package.json +1 -1
package/bin/freeschema.js
CHANGED
|
@@ -122,9 +122,18 @@ function generateMosquittoPassword(username, password) {
|
|
|
122
122
|
return `${username}:$7$${iterations}$${salt.toString('base64')}$${hash.toString('base64')}\n`;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
function isContainerHealthy(containerName) {
|
|
126
|
+
const r = spawnSync('docker', [
|
|
127
|
+
'inspect', '--format', '{{.State.Health.Status}}', containerName
|
|
128
|
+
], { stdio: 'pipe' });
|
|
129
|
+
return (r.stdout || '').toString().trim() === 'healthy';
|
|
130
|
+
}
|
|
131
|
+
|
|
125
132
|
function waitForAccessControl(container) {
|
|
133
|
+
if (isContainerHealthy(container)) return true; // already healthy — no wait needed
|
|
126
134
|
process.stdout.write(' Waiting for access-control-server');
|
|
127
|
-
for (let i = 0; i <
|
|
135
|
+
for (let i = 0; i < 60; i++) { // 60 × 2s = 120s
|
|
136
|
+
if (isContainerHealthy(container)) { process.stdout.write(' ready\n'); return true; }
|
|
128
137
|
const r = spawnSync('docker', [
|
|
129
138
|
'exec', container, 'curl', '-sf', 'http://localhost:7000/health'
|
|
130
139
|
], { stdio: 'pipe' });
|
|
@@ -770,8 +779,10 @@ function getWicoContainer() {
|
|
|
770
779
|
}
|
|
771
780
|
|
|
772
781
|
function waitForWicoServer(container, maxAttempts = 60) {
|
|
782
|
+
if (isContainerHealthy(container)) return true; // already healthy — no wait needed
|
|
773
783
|
process.stdout.write(' Waiting for wico-server');
|
|
774
784
|
for (let i = 0; i < maxAttempts; i++) {
|
|
785
|
+
if (isContainerHealthy(container)) { process.stdout.write(' ready\n'); return true; }
|
|
775
786
|
const r = spawnSync('docker', [
|
|
776
787
|
'exec', container, 'curl', '-sf', 'http://localhost:7000/health'
|
|
777
788
|
], { stdio: 'pipe' });
|