🐺 Initial commit - Lupul Augmentat MCP Server
- MCP server cu stdio transport pentru performanță maximă
- Tool-uri pentru file operations, HTTP requests, system commands
- Suport NATS pentru comunicare inter-module
- Configurare nginx cu API key auth și SSL
- Arhitectură modulară și extensibilă
🤖 Generated with Claude Code
This commit is contained in:
54
src/config.ts
Normal file
54
src/config.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { z } from 'zod';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const ConfigSchema = z.object({
|
||||
mcp: z.object({
|
||||
host: z.string().default('127.0.0.1'),
|
||||
port: z.number().default(19017),
|
||||
logLevel: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
|
||||
}),
|
||||
nats: z.object({
|
||||
url: z.string().default('nats://localhost:4222'),
|
||||
reconnectTimeWait: z.number().default(2000),
|
||||
maxReconnectAttempts: z.number().default(10),
|
||||
}),
|
||||
security: z.object({
|
||||
jwtSecret: z.string().min(32),
|
||||
authEnabled: z.boolean().default(true),
|
||||
}),
|
||||
modules: z.object({
|
||||
startupTimeout: z.number().default(5000),
|
||||
healthCheckInterval: z.number().default(30000),
|
||||
}),
|
||||
});
|
||||
|
||||
type Config = z.infer<typeof ConfigSchema>;
|
||||
|
||||
function loadConfig(): Config {
|
||||
const config = {
|
||||
mcp: {
|
||||
host: process.env.MCP_HOST || '127.0.0.1',
|
||||
port: parseInt(process.env.MCP_PORT || '19017', 10),
|
||||
logLevel: process.env.MCP_LOG_LEVEL || 'info',
|
||||
},
|
||||
nats: {
|
||||
url: process.env.NATS_URL || 'nats://localhost:4222',
|
||||
reconnectTimeWait: parseInt(process.env.NATS_RECONNECT_TIME_WAIT || '2000', 10),
|
||||
maxReconnectAttempts: parseInt(process.env.NATS_MAX_RECONNECT_ATTEMPTS || '10', 10),
|
||||
},
|
||||
security: {
|
||||
jwtSecret: process.env.JWT_SECRET || 'development-secret-change-in-production-minimum-32-chars',
|
||||
authEnabled: process.env.AUTH_ENABLED !== 'false',
|
||||
},
|
||||
modules: {
|
||||
startupTimeout: parseInt(process.env.MODULE_STARTUP_TIMEOUT || '5000', 10),
|
||||
healthCheckInterval: parseInt(process.env.MODULE_HEALTH_CHECK_INTERVAL || '30000', 10),
|
||||
},
|
||||
};
|
||||
|
||||
return ConfigSchema.parse(config);
|
||||
}
|
||||
|
||||
export const config = loadConfig();
|
||||
Reference in New Issue
Block a user