Skip to content

Commit 2d2d540

Browse files
committed
fixes
1 parent b0dc257 commit 2d2d540

File tree

6 files changed

+185
-4
lines changed

6 files changed

+185
-4
lines changed

docs/docs/configuration/auth/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Sourcebot's built-in authentication system gates your deployment, and allows adm
1010
<Card horizontal title="Authentication providers" icon="lock" href="/docs/configuration/auth/providers">
1111
Configure additional authentication providers for your deployment.
1212
</Card>
13-
<Card horizontal title="Inviting members" icon="user" href="/docs/configuration/auth/inviting-members">
13+
<Card horizontal title="Access settings" icon="user" href="/docs/configuration/auth/access-settings">
1414
Learn how to configure how members join your deployment.
1515
</Card>
1616
<Card horizontal title="Roles and permissions" icon="shield" href="/docs/configuration/auth/roles-and-permissions">

docs/snippets/schemas/v3/index.schema.mdx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4273,6 +4273,89 @@
42734273
}
42744274
]
42754275
}
4276+
},
4277+
"apps": {
4278+
"type": "array",
4279+
"description": "Defines a collection of apps that are available to Sourcebot.",
4280+
"items": {
4281+
"$schema": "http://json-schema.org/draft-07/schema#",
4282+
"title": "AppConfig",
4283+
"oneOf": [
4284+
{
4285+
"$schema": "http://json-schema.org/draft-07/schema#",
4286+
"type": "object",
4287+
"title": "GithubAppConfig",
4288+
"properties": {
4289+
"type": {
4290+
"const": "githubApp",
4291+
"description": "GitHub App Configuration"
4292+
},
4293+
"deploymentHostname": {
4294+
"type": "string",
4295+
"format": "hostname",
4296+
"default": "github.com",
4297+
"description": "The hostname of the GitHub App deployment.",
4298+
"examples": [
4299+
"github.com",
4300+
"github.example.com"
4301+
]
4302+
},
4303+
"id": {
4304+
"type": "string",
4305+
"description": "The ID of the GitHub App."
4306+
},
4307+
"privateKey": {
4308+
"anyOf": [
4309+
{
4310+
"type": "object",
4311+
"properties": {
4312+
"secret": {
4313+
"type": "string",
4314+
"description": "The name of the secret that contains the token."
4315+
}
4316+
},
4317+
"required": [
4318+
"secret"
4319+
],
4320+
"additionalProperties": false
4321+
},
4322+
{
4323+
"type": "object",
4324+
"properties": {
4325+
"env": {
4326+
"type": "string",
4327+
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
4328+
}
4329+
},
4330+
"required": [
4331+
"env"
4332+
],
4333+
"additionalProperties": false
4334+
}
4335+
],
4336+
"description": "The private key of the GitHub App."
4337+
}
4338+
},
4339+
"required": [
4340+
"type",
4341+
"id"
4342+
],
4343+
"oneOf": [
4344+
{
4345+
"required": [
4346+
"privateKey"
4347+
]
4348+
},
4349+
{
4350+
"required": [
4351+
"privateKeyPath"
4352+
]
4353+
}
4354+
],
4355+
"additionalProperties": false
4356+
}
4357+
]
4358+
}
42764359
}
42774360
},
42784361
"additionalProperties": false

packages/backend/src/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ export const fetchWithRetry = async <T>(
130130
export const getAuthCredentialsForRepo = async (repo: RepoWithConnections, db: PrismaClient, logger?: Logger): Promise<RepoAuthCredentials | undefined> => {
131131
// If we have github apps configured we assume that we must use them for github service auth
132132
if (repo.external_codeHostType === 'github' && hasEntitlement('github-app') && GithubAppManager.getInstance().appsConfigured()) {
133-
const org = repo.displayName?.split('/')[0];
133+
const owner = repo.displayName?.split('/')[0];
134134
const deploymentHostname = new URL(repo.external_codeHostUrl).hostname;
135-
if (!org || !deploymentHostname) {
135+
if (!owner || !deploymentHostname) {
136136
throw new Error(`Failed to fetch GitHub App for repo ${repo.displayName}:Invalid repo displayName (${repo.displayName}) or deployment hostname (${deploymentHostname})`);
137137
}
138138

139-
const token = await GithubAppManager.getInstance().getInstallationToken(org, deploymentHostname);
139+
const token = await GithubAppManager.getInstance().getInstallationToken(owner, deploymentHostname);
140140
return {
141141
hostUrl: repo.external_codeHostUrl,
142142
token,

packages/schemas/src/v3/index.schema.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4272,6 +4272,89 @@ const schema = {
42724272
}
42734273
]
42744274
}
4275+
},
4276+
"apps": {
4277+
"type": "array",
4278+
"description": "Defines a collection of apps that are available to Sourcebot.",
4279+
"items": {
4280+
"$schema": "http://json-schema.org/draft-07/schema#",
4281+
"title": "AppConfig",
4282+
"oneOf": [
4283+
{
4284+
"$schema": "http://json-schema.org/draft-07/schema#",
4285+
"type": "object",
4286+
"title": "GithubAppConfig",
4287+
"properties": {
4288+
"type": {
4289+
"const": "githubApp",
4290+
"description": "GitHub App Configuration"
4291+
},
4292+
"deploymentHostname": {
4293+
"type": "string",
4294+
"format": "hostname",
4295+
"default": "github.com",
4296+
"description": "The hostname of the GitHub App deployment.",
4297+
"examples": [
4298+
"github.com",
4299+
"github.example.com"
4300+
]
4301+
},
4302+
"id": {
4303+
"type": "string",
4304+
"description": "The ID of the GitHub App."
4305+
},
4306+
"privateKey": {
4307+
"anyOf": [
4308+
{
4309+
"type": "object",
4310+
"properties": {
4311+
"secret": {
4312+
"type": "string",
4313+
"description": "The name of the secret that contains the token."
4314+
}
4315+
},
4316+
"required": [
4317+
"secret"
4318+
],
4319+
"additionalProperties": false
4320+
},
4321+
{
4322+
"type": "object",
4323+
"properties": {
4324+
"env": {
4325+
"type": "string",
4326+
"description": "The name of the environment variable that contains the token. Only supported in declarative connection configs."
4327+
}
4328+
},
4329+
"required": [
4330+
"env"
4331+
],
4332+
"additionalProperties": false
4333+
}
4334+
],
4335+
"description": "The private key of the GitHub App."
4336+
}
4337+
},
4338+
"required": [
4339+
"type",
4340+
"id"
4341+
],
4342+
"oneOf": [
4343+
{
4344+
"required": [
4345+
"privateKey"
4346+
]
4347+
},
4348+
{
4349+
"required": [
4350+
"privateKeyPath"
4351+
]
4352+
}
4353+
],
4354+
"additionalProperties": false
4355+
}
4356+
]
4357+
}
42754358
}
42764359
},
42774360
"additionalProperties": false

packages/schemas/src/v3/index.type.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export type LanguageModel =
2525
| OpenAICompatibleLanguageModel
2626
| OpenRouterLanguageModel
2727
| XaiLanguageModel;
28+
export type AppConfig = GithubAppConfig;
29+
export type GithubAppConfig = {
30+
[k: string]: unknown;
31+
};
2832

2933
export interface SourcebotConfig {
3034
$schema?: string;
@@ -45,6 +49,10 @@ export interface SourcebotConfig {
4549
* Defines a collection of language models that are available to Sourcebot.
4650
*/
4751
models?: LanguageModel[];
52+
/**
53+
* Defines a collection of apps that are available to Sourcebot.
54+
*/
55+
apps?: AppConfig[];
4856
}
4957
/**
5058
* Defines the global settings for Sourcebot.

schemas/v3/index.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@
118118
"items": {
119119
"$ref": "./languageModel.json"
120120
}
121+
},
122+
"apps": {
123+
"type": "array",
124+
"description": "Defines a collection of apps that are available to Sourcebot.",
125+
"items": {
126+
"$ref": "./app.json"
127+
}
121128
}
122129
},
123130
"additionalProperties": false

0 commit comments

Comments
 (0)