Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/shared/src/env.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,18 @@ export const loadConfig = async (configPath?: string): Promise<SourcebotConfig>
const config = JSON.parse(stripJsonComments(configContent)) as SourcebotConfig;
const isValidConfig = ajv.validate(indexSchema, config);
if (!isValidConfig) {
throw new Error(`Config file '${configPath}' is invalid: ${ajv.errorsText(ajv.errors)}`);
const fileUrlConnections = Object.entries((config as any)?.connections ?? {})
.filter(([, conn]: [string, any]) => conn?.url?.startsWith('file://'))
.map(([name]) => name);

const hint = fileUrlConnections.length > 0
? ` Hint: connection(s) [${fileUrlConnections.join(', ')}] use a file:// URL. ` +
`Make sure the local repository is mounted into the Docker container and ` +
`the URL reflects the container-internal path (e.g. file:///repos/my-repo), ` +
`not the host machine path.`
: '';

throw new Error(`Config file '${configPath}' is invalid: ${ajv.errorsText(ajv.errors)}.${hint}`);
}
return config;
}
Expand Down