UNPKG

bybit-mcp-server

Version:
34 lines 1.37 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadConfig = loadConfig; exports.validateConfig = validateConfig; const dotenv_1 = __importDefault(require("dotenv")); const types_js_1 = require("./types.js"); dotenv_1.default.config(); function loadConfig() { const config = { apiKey: process.env.BYBIT_API_KEY || '', apiSecret: process.env.BYBIT_API_SECRET || '', environment: process.env.BYBIT_ENVIRONMENT || 'testnet', baseUrl: process.env.BYBIT_BASE_URL || undefined, debug: process.env.DEBUG === 'true', }; try { return types_js_1.BybitConfig.parse(config); } catch (error) { console.error('Configuration validation failed:', error); throw new Error('Invalid configuration. Please check your environment variables.'); } } function validateConfig(config) { if (!config.apiKey || !config.apiSecret) { throw new Error('BYBIT_API_KEY and BYBIT_API_SECRET environment variables are required'); } // Note: Avoid console output in MCP servers as it interferes with JSON-RPC protocol // Environment info is logged via logError in server.ts instead } //# sourceMappingURL=config.js.map