( filepath: string, )
| 72 | import { validateConfig } from "./validation.js"; |
| 73 | |
| 74 | export function resolveSerializedConfig( |
| 75 | filepath: string, |
| 76 | ): SerializedContinueConfig { |
| 77 | let content = fs.readFileSync(filepath, "utf8"); |
| 78 | const config = JSONC.parse(content) as unknown as SerializedContinueConfig; |
| 79 | if (config.env && Array.isArray(config.env)) { |
| 80 | const env = { |
| 81 | ...process.env, |
| 82 | ...getContinueDotEnv(), |
| 83 | }; |
| 84 | |
| 85 | config.env.forEach((envVar) => { |
| 86 | if (envVar in env) { |
| 87 | content = (content as any).replaceAll( |
| 88 | new RegExp(`"${envVar}"`, "g"), |
| 89 | `"${env[envVar]}"`, |
| 90 | ); |
| 91 | } |
| 92 | }); |
| 93 | } |
| 94 | |
| 95 | return JSONC.parse(content) as unknown as SerializedContinueConfig; |
| 96 | } |
| 97 | |
| 98 | const configMergeKeys = { |
| 99 | models: (a: any, b: any) => a.title === b.title, |
no test coverage detected