@qwickapps/server 1.1.7 → 1.2.0
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/README.md +80 -0
- package/dist/core/control-panel.d.ts.map +1 -1
- package/dist/core/control-panel.js +7 -6
- package/dist/core/control-panel.js.map +1 -1
- package/dist/core/gateway.d.ts +5 -0
- package/dist/core/gateway.d.ts.map +1 -1
- package/dist/core/gateway.js +413 -31
- package/dist/core/gateway.js.map +1 -1
- package/dist/core/logging.js +1 -1
- package/dist/core/logging.js.map +1 -1
- package/package.json +1 -1
- package/src/core/control-panel.ts +8 -7
- package/src/core/gateway.ts +437 -32
- package/src/core/logging.ts +1 -1
package/dist/core/gateway.js
CHANGED
|
@@ -113,6 +113,375 @@ function generateLandingPageHtml(config, controlPanelPath) {
|
|
|
113
113
|
</body>
|
|
114
114
|
</html>`;
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Generate default landing page HTML when no frontend app is configured
|
|
118
|
+
* Shows system status with animated background
|
|
119
|
+
*/
|
|
120
|
+
function generateDefaultLandingPageHtml(productName, controlPanelPath, apiBasePath, version, logoUrl) {
|
|
121
|
+
return `<!DOCTYPE html>
|
|
122
|
+
<html lang="en">
|
|
123
|
+
<head>
|
|
124
|
+
<meta charset="UTF-8">
|
|
125
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
126
|
+
<title>${productName}</title>
|
|
127
|
+
<style>
|
|
128
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
129
|
+
|
|
130
|
+
:root {
|
|
131
|
+
--primary: #6366f1;
|
|
132
|
+
--primary-glow: rgba(99, 102, 241, 0.4);
|
|
133
|
+
--success: #22c55e;
|
|
134
|
+
--warning: #f59e0b;
|
|
135
|
+
--error: #ef4444;
|
|
136
|
+
--bg-dark: #0a0a0f;
|
|
137
|
+
--bg-card: rgba(255, 255, 255, 0.03);
|
|
138
|
+
--text-primary: #f1f5f9;
|
|
139
|
+
--text-secondary: #94a3b8;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
body {
|
|
143
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
|
|
144
|
+
background: var(--bg-dark);
|
|
145
|
+
color: var(--text-primary);
|
|
146
|
+
min-height: 100vh;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
justify-content: center;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* Animated gradient background */
|
|
154
|
+
.bg-gradient {
|
|
155
|
+
position: fixed;
|
|
156
|
+
top: 0;
|
|
157
|
+
left: 0;
|
|
158
|
+
right: 0;
|
|
159
|
+
bottom: 0;
|
|
160
|
+
background:
|
|
161
|
+
radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
|
|
162
|
+
radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
|
|
163
|
+
radial-gradient(ellipse at 50% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
|
|
164
|
+
animation: gradientShift 15s ease-in-out infinite;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@keyframes gradientShift {
|
|
168
|
+
0%, 100% {
|
|
169
|
+
background-position: 0% 0%, 100% 100%, 50% 50%;
|
|
170
|
+
opacity: 1;
|
|
171
|
+
}
|
|
172
|
+
50% {
|
|
173
|
+
background-position: 100% 0%, 0% 100%, 50% 50%;
|
|
174
|
+
opacity: 0.8;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Floating particles */
|
|
179
|
+
.particles {
|
|
180
|
+
position: fixed;
|
|
181
|
+
top: 0;
|
|
182
|
+
left: 0;
|
|
183
|
+
right: 0;
|
|
184
|
+
bottom: 0;
|
|
185
|
+
overflow: hidden;
|
|
186
|
+
pointer-events: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.particle {
|
|
190
|
+
position: absolute;
|
|
191
|
+
width: 4px;
|
|
192
|
+
height: 4px;
|
|
193
|
+
background: var(--primary);
|
|
194
|
+
border-radius: 50%;
|
|
195
|
+
opacity: 0.3;
|
|
196
|
+
animation: float 20s infinite;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 25s; }
|
|
200
|
+
.particle:nth-child(2) { left: 20%; animation-delay: 2s; animation-duration: 20s; }
|
|
201
|
+
.particle:nth-child(3) { left: 30%; animation-delay: 4s; animation-duration: 28s; }
|
|
202
|
+
.particle:nth-child(4) { left: 40%; animation-delay: 1s; animation-duration: 22s; }
|
|
203
|
+
.particle:nth-child(5) { left: 50%; animation-delay: 3s; animation-duration: 24s; }
|
|
204
|
+
.particle:nth-child(6) { left: 60%; animation-delay: 5s; animation-duration: 26s; }
|
|
205
|
+
.particle:nth-child(7) { left: 70%; animation-delay: 2s; animation-duration: 21s; }
|
|
206
|
+
.particle:nth-child(8) { left: 80%; animation-delay: 4s; animation-duration: 23s; }
|
|
207
|
+
.particle:nth-child(9) { left: 90%; animation-delay: 1s; animation-duration: 27s; }
|
|
208
|
+
|
|
209
|
+
@keyframes float {
|
|
210
|
+
0% { transform: translateY(100vh) scale(0); opacity: 0; }
|
|
211
|
+
10% { opacity: 0.3; }
|
|
212
|
+
90% { opacity: 0.3; }
|
|
213
|
+
100% { transform: translateY(-100vh) scale(1); opacity: 0; }
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* Grid pattern overlay */
|
|
217
|
+
.grid-overlay {
|
|
218
|
+
position: fixed;
|
|
219
|
+
top: 0;
|
|
220
|
+
left: 0;
|
|
221
|
+
right: 0;
|
|
222
|
+
bottom: 0;
|
|
223
|
+
background-image:
|
|
224
|
+
linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
|
|
225
|
+
linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
|
|
226
|
+
background-size: 60px 60px;
|
|
227
|
+
pointer-events: none;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.container {
|
|
231
|
+
position: relative;
|
|
232
|
+
z-index: 10;
|
|
233
|
+
text-align: center;
|
|
234
|
+
max-width: 500px;
|
|
235
|
+
padding: 3rem 2rem;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.logo {
|
|
239
|
+
width: 80px;
|
|
240
|
+
height: 80px;
|
|
241
|
+
margin: 0 auto 2rem;
|
|
242
|
+
display: flex;
|
|
243
|
+
align-items: center;
|
|
244
|
+
justify-content: center;
|
|
245
|
+
animation: logoFloat 6s ease-in-out infinite;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.logo.default {
|
|
249
|
+
background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
|
|
250
|
+
border-radius: 20px;
|
|
251
|
+
box-shadow: 0 20px 40px var(--primary-glow);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.logo.custom {
|
|
255
|
+
filter: drop-shadow(0 20px 40px var(--primary-glow));
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
@keyframes logoFloat {
|
|
259
|
+
0%, 100% { transform: translateY(0); }
|
|
260
|
+
50% { transform: translateY(-10px); }
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.logo svg {
|
|
264
|
+
width: 48px;
|
|
265
|
+
height: 48px;
|
|
266
|
+
fill: white;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.logo img {
|
|
270
|
+
width: 80px;
|
|
271
|
+
height: 80px;
|
|
272
|
+
object-fit: contain;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
h1 {
|
|
276
|
+
font-size: 2.5rem;
|
|
277
|
+
font-weight: 700;
|
|
278
|
+
margin-bottom: 0.5rem;
|
|
279
|
+
background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary) 100%);
|
|
280
|
+
-webkit-background-clip: text;
|
|
281
|
+
-webkit-text-fill-color: transparent;
|
|
282
|
+
background-clip: text;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.status-badge {
|
|
286
|
+
display: inline-flex;
|
|
287
|
+
align-items: center;
|
|
288
|
+
gap: 0.5rem;
|
|
289
|
+
padding: 0.75rem 1.5rem;
|
|
290
|
+
background: var(--bg-card);
|
|
291
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
292
|
+
border-radius: 100px;
|
|
293
|
+
margin: 1.5rem 0 2rem;
|
|
294
|
+
backdrop-filter: blur(10px);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.status-dot {
|
|
298
|
+
width: 10px;
|
|
299
|
+
height: 10px;
|
|
300
|
+
border-radius: 50%;
|
|
301
|
+
background: var(--success);
|
|
302
|
+
box-shadow: 0 0 10px var(--success);
|
|
303
|
+
animation: pulse 2s ease-in-out infinite;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.status-dot.degraded {
|
|
307
|
+
background: var(--warning);
|
|
308
|
+
box-shadow: 0 0 10px var(--warning);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.status-dot.unhealthy {
|
|
312
|
+
background: var(--error);
|
|
313
|
+
box-shadow: 0 0 10px var(--error);
|
|
314
|
+
animation: none;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
@keyframes pulse {
|
|
318
|
+
0%, 100% { opacity: 1; transform: scale(1); }
|
|
319
|
+
50% { opacity: 0.7; transform: scale(1.1); }
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.status-text {
|
|
323
|
+
font-size: 0.95rem;
|
|
324
|
+
font-weight: 500;
|
|
325
|
+
color: var(--text-primary);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.description {
|
|
329
|
+
color: var(--text-secondary);
|
|
330
|
+
font-size: 1rem;
|
|
331
|
+
line-height: 1.6;
|
|
332
|
+
margin-bottom: 2rem;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.links {
|
|
336
|
+
display: flex;
|
|
337
|
+
flex-wrap: wrap;
|
|
338
|
+
gap: 1rem;
|
|
339
|
+
justify-content: center;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.link {
|
|
343
|
+
display: inline-flex;
|
|
344
|
+
align-items: center;
|
|
345
|
+
gap: 0.5rem;
|
|
346
|
+
padding: 0.875rem 1.75rem;
|
|
347
|
+
background: var(--primary);
|
|
348
|
+
color: white;
|
|
349
|
+
text-decoration: none;
|
|
350
|
+
border-radius: 12px;
|
|
351
|
+
font-weight: 500;
|
|
352
|
+
font-size: 0.95rem;
|
|
353
|
+
transition: all 0.3s ease;
|
|
354
|
+
box-shadow: 0 4px 15px var(--primary-glow);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.link:hover {
|
|
358
|
+
transform: translateY(-2px);
|
|
359
|
+
box-shadow: 0 8px 25px var(--primary-glow);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.footer {
|
|
363
|
+
position: fixed;
|
|
364
|
+
bottom: 1.5rem;
|
|
365
|
+
left: 0;
|
|
366
|
+
right: 0;
|
|
367
|
+
text-align: center;
|
|
368
|
+
color: var(--text-secondary);
|
|
369
|
+
font-size: 0.85rem;
|
|
370
|
+
z-index: 10;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.footer a {
|
|
374
|
+
color: var(--primary);
|
|
375
|
+
text-decoration: none;
|
|
376
|
+
font-weight: 500;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.footer a:hover {
|
|
380
|
+
text-decoration: underline;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/* Loading state */
|
|
384
|
+
.loading .status-dot {
|
|
385
|
+
background: var(--text-secondary);
|
|
386
|
+
box-shadow: none;
|
|
387
|
+
animation: none;
|
|
388
|
+
}
|
|
389
|
+
</style>
|
|
390
|
+
</head>
|
|
391
|
+
<body>
|
|
392
|
+
<div class="bg-gradient"></div>
|
|
393
|
+
<div class="particles">
|
|
394
|
+
<div class="particle"></div>
|
|
395
|
+
<div class="particle"></div>
|
|
396
|
+
<div class="particle"></div>
|
|
397
|
+
<div class="particle"></div>
|
|
398
|
+
<div class="particle"></div>
|
|
399
|
+
<div class="particle"></div>
|
|
400
|
+
<div class="particle"></div>
|
|
401
|
+
<div class="particle"></div>
|
|
402
|
+
<div class="particle"></div>
|
|
403
|
+
</div>
|
|
404
|
+
<div class="grid-overlay"></div>
|
|
405
|
+
|
|
406
|
+
<div class="container">
|
|
407
|
+
${logoUrl
|
|
408
|
+
? `<div class="logo custom"><img src="/logo.svg" alt="${productName} logo" /></div>`
|
|
409
|
+
: `<div class="logo default">
|
|
410
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
411
|
+
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/>
|
|
412
|
+
</svg>
|
|
413
|
+
</div>`}
|
|
414
|
+
|
|
415
|
+
<h1>${productName}</h1>
|
|
416
|
+
|
|
417
|
+
<div class="status-badge loading" id="status-badge">
|
|
418
|
+
<div class="status-dot" id="status-dot"></div>
|
|
419
|
+
<span class="status-text" id="status-text">Checking status...</span>
|
|
420
|
+
</div>
|
|
421
|
+
|
|
422
|
+
<p class="description" id="description">
|
|
423
|
+
Enterprise-grade service powered by QwickApps
|
|
424
|
+
</p>
|
|
425
|
+
|
|
426
|
+
<div class="links">
|
|
427
|
+
<a href="${controlPanelPath}" class="link">
|
|
428
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
429
|
+
<rect x="3" y="3" width="7" height="7"></rect>
|
|
430
|
+
<rect x="14" y="3" width="7" height="7"></rect>
|
|
431
|
+
<rect x="14" y="14" width="7" height="7"></rect>
|
|
432
|
+
<rect x="3" y="14" width="7" height="7"></rect>
|
|
433
|
+
</svg>
|
|
434
|
+
Control Panel
|
|
435
|
+
</a>
|
|
436
|
+
</div>
|
|
437
|
+
</div>
|
|
438
|
+
|
|
439
|
+
<div class="footer">
|
|
440
|
+
Powered by <a href="https://qwickapps.com" target="_blank">QwickApps Server</a> - <a href="https://github.com/qwickapps/server" target="_blank">Version ${version}</a>
|
|
441
|
+
</div>
|
|
442
|
+
|
|
443
|
+
<script>
|
|
444
|
+
async function checkStatus() {
|
|
445
|
+
const badge = document.getElementById('status-badge');
|
|
446
|
+
const dot = document.getElementById('status-dot');
|
|
447
|
+
const text = document.getElementById('status-text');
|
|
448
|
+
const desc = document.getElementById('description');
|
|
449
|
+
|
|
450
|
+
try {
|
|
451
|
+
// Use /health (public, proxied from service) instead of control panel API
|
|
452
|
+
const res = await fetch('/health');
|
|
453
|
+
const data = await res.json();
|
|
454
|
+
|
|
455
|
+
badge.classList.remove('loading');
|
|
456
|
+
|
|
457
|
+
if (data.status === 'healthy') {
|
|
458
|
+
dot.className = 'status-dot';
|
|
459
|
+
text.textContent = 'All systems operational';
|
|
460
|
+
desc.textContent = 'The service is running smoothly and ready to handle requests.';
|
|
461
|
+
} else if (data.status === 'degraded') {
|
|
462
|
+
dot.className = 'status-dot degraded';
|
|
463
|
+
text.textContent = 'Degraded performance';
|
|
464
|
+
desc.textContent = 'Some services may be experiencing issues. Core functionality remains available.';
|
|
465
|
+
} else {
|
|
466
|
+
dot.className = 'status-dot unhealthy';
|
|
467
|
+
text.textContent = 'System maintenance';
|
|
468
|
+
desc.textContent = 'The service is currently undergoing maintenance. Please check back shortly.';
|
|
469
|
+
}
|
|
470
|
+
} catch (e) {
|
|
471
|
+
badge.classList.remove('loading');
|
|
472
|
+
dot.className = 'status-dot unhealthy';
|
|
473
|
+
text.textContent = 'Unable to connect';
|
|
474
|
+
desc.textContent = 'Could not reach the service. Please try again later.';
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
// Check status on load and every 30 seconds
|
|
479
|
+
checkStatus();
|
|
480
|
+
setInterval(checkStatus, 30000);
|
|
481
|
+
</script>
|
|
482
|
+
</body>
|
|
483
|
+
</html>`;
|
|
484
|
+
}
|
|
116
485
|
/**
|
|
117
486
|
* Create a gateway that proxies to an internal service
|
|
118
487
|
*
|
|
@@ -161,13 +530,15 @@ export function createGateway(config, serviceFactory) {
|
|
|
161
530
|
const guardConfig = config.controlPanelGuard;
|
|
162
531
|
// API paths to proxy
|
|
163
532
|
const proxyPaths = config.proxyPaths || ['/api/v1'];
|
|
533
|
+
// Version for display
|
|
534
|
+
const version = config.version || process.env.npm_package_version || '1.0.0';
|
|
164
535
|
let service = null;
|
|
165
536
|
// Create control panel
|
|
166
537
|
const controlPanel = createControlPanel({
|
|
167
538
|
config: {
|
|
168
539
|
productName: config.productName,
|
|
169
540
|
port: gatewayPort,
|
|
170
|
-
version
|
|
541
|
+
version,
|
|
171
542
|
branding: config.branding,
|
|
172
543
|
cors: config.corsOrigins ? { origins: config.corsOrigins } : undefined,
|
|
173
544
|
// Skip body parsing for proxied paths
|
|
@@ -228,15 +599,33 @@ export function createGateway(config, serviceFactory) {
|
|
|
228
599
|
};
|
|
229
600
|
controlPanel.app.use(createProxyMiddleware(healthProxyOptions));
|
|
230
601
|
};
|
|
602
|
+
// Calculate API base path for landing page
|
|
603
|
+
const apiBasePath = controlPanelPath === '/' ? '/api' : `${controlPanelPath}/api`;
|
|
231
604
|
// Setup frontend app at root path
|
|
232
605
|
const setupFrontendApp = () => {
|
|
606
|
+
// Serve logo at /logo.svg if logoUrl is configured and customUiPath exists
|
|
607
|
+
if (config.logoUrl && config.customUiPath) {
|
|
608
|
+
const logoPath = resolve(config.customUiPath, 'logo.svg');
|
|
609
|
+
if (existsSync(logoPath)) {
|
|
610
|
+
controlPanel.app.get('/logo.svg', (_req, res) => {
|
|
611
|
+
res.sendFile(logoPath);
|
|
612
|
+
});
|
|
613
|
+
logger.debug('Frontend app: Serving logo at /logo.svg');
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
// If no frontend app configured, serve default landing page with status
|
|
233
617
|
if (!config.frontendApp) {
|
|
618
|
+
logger.debug('Frontend app: Serving default landing page');
|
|
619
|
+
controlPanel.app.get('/', (_req, res) => {
|
|
620
|
+
const html = generateDefaultLandingPageHtml(config.productName, controlPanelPath, apiBasePath, version, config.logoUrl);
|
|
621
|
+
res.type('html').send(html);
|
|
622
|
+
});
|
|
234
623
|
return;
|
|
235
624
|
}
|
|
236
625
|
const { redirectUrl, staticPath, landingPage } = config.frontendApp;
|
|
237
626
|
// Priority 1: Redirect
|
|
238
627
|
if (redirectUrl) {
|
|
239
|
-
logger.
|
|
628
|
+
logger.debug(`Frontend app: Redirecting / to ${redirectUrl}`);
|
|
240
629
|
controlPanel.app.get('/', (_req, res) => {
|
|
241
630
|
res.redirect(redirectUrl);
|
|
242
631
|
});
|
|
@@ -244,7 +633,7 @@ export function createGateway(config, serviceFactory) {
|
|
|
244
633
|
}
|
|
245
634
|
// Priority 2: Serve static files
|
|
246
635
|
if (staticPath && existsSync(staticPath)) {
|
|
247
|
-
logger.
|
|
636
|
+
logger.debug(`Frontend app: Serving static files from ${staticPath}`);
|
|
248
637
|
controlPanel.app.use('/', express.static(staticPath));
|
|
249
638
|
// SPA fallback for root
|
|
250
639
|
controlPanel.app.get('/', (_req, res) => {
|
|
@@ -254,7 +643,7 @@ export function createGateway(config, serviceFactory) {
|
|
|
254
643
|
}
|
|
255
644
|
// Priority 3: Landing page
|
|
256
645
|
if (landingPage) {
|
|
257
|
-
logger.
|
|
646
|
+
logger.debug(`Frontend app: Serving landing page`);
|
|
258
647
|
controlPanel.app.get('/', (_req, res) => {
|
|
259
648
|
const html = generateLandingPageHtml(landingPage, controlPanelPath);
|
|
260
649
|
res.type('html').send(html);
|
|
@@ -262,44 +651,37 @@ export function createGateway(config, serviceFactory) {
|
|
|
262
651
|
}
|
|
263
652
|
};
|
|
264
653
|
const start = async () => {
|
|
265
|
-
logger.
|
|
654
|
+
logger.debug('Starting gateway...');
|
|
266
655
|
// 1. Start internal service
|
|
267
|
-
logger.
|
|
656
|
+
logger.debug(`Starting internal service on port ${servicePort}...`);
|
|
268
657
|
service = await serviceFactory(servicePort);
|
|
269
|
-
logger.
|
|
658
|
+
logger.debug(`Internal service started on port ${servicePort}`);
|
|
270
659
|
// 2. Setup proxy middleware (after service is started)
|
|
271
660
|
setupProxyMiddleware();
|
|
272
661
|
// 3. Setup frontend app at root path
|
|
273
662
|
setupFrontendApp();
|
|
274
663
|
// 4. Start control panel gateway
|
|
275
664
|
await controlPanel.start();
|
|
276
|
-
//
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}
|
|
291
|
-
if (config.frontendApp) {
|
|
292
|
-
logger.info(`Frontend App: GET /`);
|
|
293
|
-
}
|
|
294
|
-
logger.info(`Control Panel UI: GET ${controlPanelPath.padEnd(20)}`);
|
|
295
|
-
logger.info(`Gateway Health: GET ${apiBasePath}/health`);
|
|
296
|
-
logger.info(`Service Health: GET /health`);
|
|
665
|
+
// Log concise startup info
|
|
666
|
+
const authInfo = guardConfig?.type === 'basic'
|
|
667
|
+
? `(auth: ${guardConfig.username})`
|
|
668
|
+
: guardConfig?.type && guardConfig.type !== 'none'
|
|
669
|
+
? `(auth: ${guardConfig.type})`
|
|
670
|
+
: '(no auth)';
|
|
671
|
+
logger.info(`${config.productName} started on port ${gatewayPort} ${authInfo}`);
|
|
672
|
+
// Log detailed route info at debug level
|
|
673
|
+
logger.debug(`Gateway Port: ${gatewayPort} (public)`);
|
|
674
|
+
logger.debug(`Service Port: ${servicePort} (internal)`);
|
|
675
|
+
logger.debug(`Frontend App: GET /`);
|
|
676
|
+
logger.debug(`Control Panel UI: GET ${controlPanelPath}`);
|
|
677
|
+
logger.debug(`Gateway Health: GET ${apiBasePath}/health`);
|
|
678
|
+
logger.debug(`Service Health: GET /health`);
|
|
297
679
|
for (const apiPath of proxyPaths) {
|
|
298
|
-
logger.
|
|
680
|
+
logger.debug(`Service API: * ${apiPath}/*`);
|
|
299
681
|
}
|
|
300
682
|
};
|
|
301
683
|
const stop = async () => {
|
|
302
|
-
logger.
|
|
684
|
+
logger.debug('Shutting down gateway...');
|
|
303
685
|
// Stop control panel
|
|
304
686
|
await controlPanel.stop();
|
|
305
687
|
// Stop internal service
|
|
@@ -307,7 +689,7 @@ export function createGateway(config, serviceFactory) {
|
|
|
307
689
|
await service.shutdown();
|
|
308
690
|
service.server.close();
|
|
309
691
|
}
|
|
310
|
-
logger.
|
|
692
|
+
logger.debug('Gateway shutdown complete');
|
|
311
693
|
};
|
|
312
694
|
return {
|
|
313
695
|
controlPanel,
|
package/dist/core/gateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../src/core/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAsB,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAgB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../src/core/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAsB,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAgB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EA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AAkB,OAAO,IAAI,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;QACrC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAEzC,qBAAqB;QACrB,MAAM,YAAY,CAAC,IAAI,EAAE,CAAC;QAE1B,wBAAwB;QACxB,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;YACzB,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC5C,CAAC,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,OAAO;QACP,KAAK;QACL,IAAI;QACJ,WAAW;QACX,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
package/dist/core/logging.js
CHANGED
|
@@ -18,7 +18,7 @@ import { resolve } from 'node:path';
|
|
|
18
18
|
import { getLogger } from '@qwickapps/logging';
|
|
19
19
|
// Default configuration
|
|
20
20
|
const DEFAULT_CONFIG = {
|
|
21
|
-
namespace: '
|
|
21
|
+
namespace: 'App',
|
|
22
22
|
level: process.env.LOG_LEVEL || (process.env.NODE_ENV === 'production' ? 'info' : 'debug'),
|
|
23
23
|
logDir: process.env.LOG_DIR || './logs',
|
|
24
24
|
fileLogging: process.env.LOG_FILE !== 'false',
|
package/dist/core/logging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../src/core/logging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,OAAO,EAAW,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAyB,SAAS,EAA0B,MAAM,oBAAoB,CAAC;AAgB9F,wBAAwB;AACxB,MAAM,cAA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AAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,OAAO,mBAAmB,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -95,14 +95,15 @@ export function createControlPanel(options: CreateControlPanelOptions): ControlP
|
|
|
95
95
|
}
|
|
96
96
|
app.use(compression());
|
|
97
97
|
|
|
98
|
-
//
|
|
98
|
+
// Get mount path (defaults to /cpanel)
|
|
99
|
+
const mountPath = config.mountPath || '/cpanel';
|
|
100
|
+
|
|
101
|
+
// Apply route guard if configured - only to the control panel mount path
|
|
99
102
|
if (config.guard && config.guard.type !== 'none') {
|
|
100
103
|
const guardMiddleware = createRouteGuard(config.guard);
|
|
101
|
-
|
|
104
|
+
// Only protect the control panel path, not the root or other paths
|
|
105
|
+
app.use(mountPath, guardMiddleware);
|
|
102
106
|
}
|
|
103
|
-
|
|
104
|
-
// Get mount path (defaults to /cpanel)
|
|
105
|
-
const mountPath = config.mountPath || '/cpanel';
|
|
106
107
|
const apiBasePath = mountPath === '/' ? '/api' : `${mountPath}/api`;
|
|
107
108
|
|
|
108
109
|
// Request logging
|
|
@@ -276,7 +277,7 @@ export function createControlPanel(options: CreateControlPanelOptions): ControlP
|
|
|
276
277
|
|
|
277
278
|
return new Promise((resolve) => {
|
|
278
279
|
server = app.listen(config.port, () => {
|
|
279
|
-
logger.
|
|
280
|
+
logger.debug(`Control panel listening on port ${config.port}`);
|
|
280
281
|
resolve();
|
|
281
282
|
});
|
|
282
283
|
});
|
|
@@ -298,7 +299,7 @@ export function createControlPanel(options: CreateControlPanelOptions): ControlP
|
|
|
298
299
|
if (server) {
|
|
299
300
|
return new Promise((resolve) => {
|
|
300
301
|
server!.close(() => {
|
|
301
|
-
logger.
|
|
302
|
+
logger.debug('Control panel stopped');
|
|
302
303
|
resolve();
|
|
303
304
|
});
|
|
304
305
|
});
|