Fixes related to config loader
This commit is contained in:
@@ -21,7 +21,6 @@
|
|||||||
"test:coverage": "jest --coverage",
|
"test:coverage": "jest --coverage",
|
||||||
"lint": "eslint src --ext .ts --config eslint.config.mjs",
|
"lint": "eslint src --ext .ts --config eslint.config.mjs",
|
||||||
"format": "prettier --write 'src/**/*.ts' 'scripts/**/*.js'",
|
"format": "prettier --write 'src/**/*.ts' 'scripts/**/*.js'",
|
||||||
"cli": "npm run build && node dist/index.js",
|
|
||||||
"mcp:stdio": "TRANSPORT_MODE=stdio npm run build && node dist/index.js",
|
"mcp:stdio": "TRANSPORT_MODE=stdio npm run build && node dist/index.js",
|
||||||
"mcp:http": "TRANSPORT_MODE=http npm run build && node dist/index.js",
|
"mcp:http": "TRANSPORT_MODE=http npm run build && node dist/index.js",
|
||||||
"mcp:inspect": "TRANSPORT_MODE=http npm run build && (node dist/index.js &) && sleep 2 && npx @modelcontextprotocol/inspector http://localhost:3000/mcp",
|
"mcp:inspect": "TRANSPORT_MODE=http npm run build && (node dist/index.js &) && sleep 2 && npx @modelcontextprotocol/inspector http://localhost:3000/mcp",
|
||||||
|
|||||||
@@ -7,7 +7,15 @@ export const CommonConfigSchema = z.object({
|
|||||||
serviceName: z.string().default('llm-observability-mcp'),
|
serviceName: z.string().default('llm-observability-mcp'),
|
||||||
serviceVersion: z.string().default('1.0.0'),
|
serviceVersion: z.string().default('1.0.0'),
|
||||||
environment: z.string().default('development'),
|
environment: z.string().default('development'),
|
||||||
debug: z.boolean().default(false),
|
debug: z
|
||||||
|
.preprocess((val) => {
|
||||||
|
if (typeof val === 'string') {
|
||||||
|
if (val.toLowerCase() === 'false') return false;
|
||||||
|
if (val.toLowerCase() === 'true') return true;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}, z.boolean())
|
||||||
|
.default(false),
|
||||||
logLevel: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
|
logLevel: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
import { Logger } from './utils/logger.util.js';
|
import { Logger } from './utils/logger.util.js';
|
||||||
import configLoader from './config/config-loader.js';
|
|
||||||
import { stdioTransport } from './server/stdio.js';
|
import { stdioTransport } from './server/stdio.js';
|
||||||
import { streamableHttpTransport } from './server/streamableHttp.js';
|
import { streamableHttpTransport } from './server/streamableHttp.js';
|
||||||
|
|
||||||
@@ -42,9 +41,6 @@ export async function startServer(): Promise<void> {
|
|||||||
* Main entry point
|
* Main entry point
|
||||||
*/
|
*/
|
||||||
async function main() {
|
async function main() {
|
||||||
// Load configuration
|
|
||||||
configLoader.load();
|
|
||||||
|
|
||||||
// Server mode - determine transport and start server
|
// Server mode - determine transport and start server
|
||||||
await startServer();
|
await startServer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ export class OpenTelemetryService {
|
|||||||
[ATTR_SERVICE_NAME]: this.config.serviceName,
|
[ATTR_SERVICE_NAME]: this.config.serviceName,
|
||||||
[ATTR_SERVICE_VERSION]: this.config.serviceVersion,
|
[ATTR_SERVICE_VERSION]: this.config.serviceVersion,
|
||||||
[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: this.config.environment,
|
[SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: this.config.environment,
|
||||||
|
debug: this.config.debug,
|
||||||
|
logLevel: this.config.logLevel,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Configure metric exporter
|
// Configure metric exporter
|
||||||
|
|||||||
Reference in New Issue
Block a user