UNPKG

@chainlink/mcp-server

Version:
35 lines 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadCcipDataSources = void 0; const fs_1 = require("fs"); const logger_1 = require("../../../utils/logger"); const cache_1 = require("./cache"); const ccip_config_1 = require("../../../schemas/ccip-config"); const paths_1 = require("../../../utils/paths"); const loadCcipDataSources = async (product, environment) => { const existing = (0, cache_1.getCachedCcipConfig)(product, environment); if (existing !== undefined) { return existing; } try { const filePath = (0, paths_1.getCcipCombinedConfigPath)(environment); logger_1.Logger.debug(`Attempting to load combined CCIP config from: ${filePath}`); if (!(0, fs_1.existsSync)(filePath)) { logger_1.Logger.debug(`CCIP config file not found: ${filePath}`); return null; } const rawData = (0, fs_1.readFileSync)(filePath, "utf8"); const jsonData = JSON.parse(rawData); const validatedData = ccip_config_1.CombinedCcipConfigSchema.parse(jsonData); (0, cache_1.setCachedCcipConfig)(product, environment, validatedData); logger_1.Logger.debug(`Loaded and validated ${product} combined config for ${environment}`); return validatedData; } catch (error) { logger_1.Logger.debug(`Failed to load ${product} combined config for ${environment}: ${error}`); (0, cache_1.setCachedCcipConfig)(product, environment, null); return null; } }; exports.loadCcipDataSources = loadCcipDataSources; //# sourceMappingURL=load.js.map