MCPcopy Create free account
hub / github.com/MigoXLab/coderio / loadConfig

Function loadConfig

src/utils/config.ts:52–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 * @returns Full configuration object
51 */
52export function loadConfig(): Config {
53 if (cachedConfig) {
54 return cachedConfig;
55 }
56
57 if (!existsSync(CONFIG_FILE)) {
58 throw new Error(`Configuration file not found at: ${CONFIG_FILE}\n` + `Please create the configuration file.`);
59 }
60
61 try {
62 const fileContent = readFileSync(CONFIG_FILE, 'utf8');
63 const rawConfig = yaml.load(fileContent) as Config;
64
65 if (!rawConfig) {
66 throw new Error('Invalid config.yaml structure: configuration is empty');
67 }
68
69 cachedConfig = rawConfig;
70 return cachedConfig;
71 } catch (error) {
72 if (error instanceof Error) {
73 throw new Error(`Failed to load config.yaml: ${error.message}`);
74 }
75 throw error;
76 }
77}
78
79/**
80 * Get model configuration from config.yaml

Callers 3

getModelConfigFunction · 0.85
getFigmaConfigFunction · 0.85
getDebugConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected