Skip to content

Commit 23f2377

Browse files
random: set CONFIG_MAX_REPOS_NO_TOKEN default to max int, effectively disabling this feature by default (since this is only useful in certain scenarios like cloud)
1 parent 11efaa6 commit 23f2377

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

packages/web/src/actions.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,15 @@ const parseConnectionConfig = (connectionType: string, config: string) => {
14331433
} satisfies ServiceError;
14341434
}
14351435

1436+
const isValidConfig = ajv.validate(schema, parsedConfig);
1437+
if (!isValidConfig) {
1438+
return {
1439+
statusCode: StatusCodes.BAD_REQUEST,
1440+
errorCode: ErrorCode.INVALID_REQUEST_BODY,
1441+
message: `config schema validation failed with errors: ${ajv.errorsText(ajv.errors)}`,
1442+
} satisfies ServiceError;
1443+
}
1444+
14361445
const { numRepos, hasToken } = (() => {
14371446
switch (connectionType) {
14381447
case "github": {
@@ -1479,15 +1488,6 @@ const parseConnectionConfig = (connectionType: string, config: string) => {
14791488
} satisfies ServiceError;
14801489
}
14811490

1482-
const isValidConfig = ajv.validate(schema, parsedConfig);
1483-
if (!isValidConfig) {
1484-
return {
1485-
statusCode: StatusCodes.BAD_REQUEST,
1486-
errorCode: ErrorCode.INVALID_REQUEST_BODY,
1487-
message: `config schema validation failed with errors: ${ajv.errorsText(ajv.errors)}`,
1488-
} satisfies ServiceError;
1489-
}
1490-
14911491
return parsedConfig;
14921492
}
14931493

packages/web/src/env.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const env = createEnv({
3232
STRIPE_ENABLE_TEST_CLOCKS: booleanSchema.default('false'),
3333

3434
// Misc
35-
CONFIG_MAX_REPOS_NO_TOKEN: z.number().default(500),
35+
CONFIG_MAX_REPOS_NO_TOKEN: z.number().default(Number.MAX_SAFE_INTEGER),
3636
SOURCEBOT_ROOT_DOMAIN: z.string().default("localhost:3000"),
3737
NODE_ENV: z.enum(["development", "test", "production"]),
3838
SOURCEBOT_TELEMETRY_DISABLED: booleanSchema.default('false'),

0 commit comments

Comments
 (0)