wilfredwake 1.0.3 → 1.0.5
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
|
@@ -85,7 +85,8 @@ export class ServiceRegistry {
|
|
|
85
85
|
*/
|
|
86
86
|
getServices(environment = 'dev') {
|
|
87
87
|
const env = this.registry?.services?.[environment] || {};
|
|
88
|
-
|
|
88
|
+
// Return service objects augmented with their name for downstream code
|
|
89
|
+
return Object.entries(env).map(([name, svc]) => ({ name, ...svc }));
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
/**
|
|
@@ -95,7 +96,9 @@ export class ServiceRegistry {
|
|
|
95
96
|
* @returns {Object|null} Service definition
|
|
96
97
|
*/
|
|
97
98
|
getService(serviceName, environment = 'dev') {
|
|
98
|
-
|
|
99
|
+
const svc = this.registry?.services?.[environment]?.[serviceName] || null;
|
|
100
|
+
if (!svc) return null;
|
|
101
|
+
return { name: serviceName, ...svc };
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
/**
|
|
@@ -125,8 +128,8 @@ export class ServiceRegistry {
|
|
|
125
128
|
// RESOLVE TARGET SERVICES
|
|
126
129
|
// ═══════════════════════════════════════════════════════════════
|
|
127
130
|
if (target === 'all') {
|
|
128
|
-
// Wake all services
|
|
129
|
-
targetServices =
|
|
131
|
+
// Wake all services (services is already an array of named objects)
|
|
132
|
+
targetServices = services;
|
|
130
133
|
} else if (Array.isArray(target)) {
|
|
131
134
|
// Wake specified services
|
|
132
135
|
targetServices = target
|
|
@@ -71,17 +71,11 @@ app.use((req, res, next) => {
|
|
|
71
71
|
* Checks Authorization header if tokens are required
|
|
72
72
|
*/
|
|
73
73
|
const validateToken = (req, res, next) => {
|
|
74
|
+
// Authentication disabled by default.
|
|
75
|
+
// This middleware intentionally acts as a no-op so the orchestrator
|
|
76
|
+
// accepts unauthenticated requests. To enable authentication again,
|
|
77
|
+
// implement validation when `process.env.REQUIRE_AUTH` is set.
|
|
74
78
|
const token = req.headers.authorization?.replace('Bearer ', '');
|
|
75
|
-
|
|
76
|
-
// For now, we accept all requests
|
|
77
|
-
// In production, validate against registered tokens
|
|
78
|
-
if (process.env.REQUIRE_AUTH && !token) {
|
|
79
|
-
return res.status(401).json({
|
|
80
|
-
success: false,
|
|
81
|
-
error: 'Missing or invalid authentication token',
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
79
|
req.userId = token || 'anonymous';
|
|
86
80
|
next();
|
|
87
81
|
};
|