mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 13:17:08 +00:00
Drop installation ID
This commit is contained in:
parent
fbfadeae1c
commit
2f994fbc81
@ -9,9 +9,6 @@ bridge:
|
||||
port: 9993
|
||||
bindAddress: 127.0.0.1
|
||||
github:
|
||||
# (Optional) Configure this to enable GitHub support
|
||||
#
|
||||
installationId: 6854059
|
||||
auth:
|
||||
id: 123
|
||||
privateKeyFile: github-key.pem
|
||||
|
@ -20,7 +20,6 @@ export interface BridgeConfigGitHub {
|
||||
// eslint-disable-next-line camelcase
|
||||
redirect_uri: string;
|
||||
};
|
||||
installationId: number|string;
|
||||
}
|
||||
|
||||
export interface GitLabInstance {
|
||||
|
@ -35,7 +35,6 @@ export const DefaultConfig = new BridgeConfig({
|
||||
avatar: "mxc://half-shot.uk/2876e89ccade4cb615e210c458e2a7a6883fe17d"
|
||||
},
|
||||
github: {
|
||||
installationId: 6854059,
|
||||
auth: {
|
||||
id: 123,
|
||||
privateKeyFile: "github-key.pem",
|
||||
|
@ -33,7 +33,6 @@ export class GithubInstance {
|
||||
const auth = {
|
||||
appId: parseInt(this.config.auth.id as string, 10),
|
||||
privateKey: await fs.readFile(this.config.auth.privateKeyFile, "utf-8"),
|
||||
installationId: parseInt(this.config.installationId as string, 10),
|
||||
};
|
||||
|
||||
this.internalOctokit = new Octokit({
|
||||
@ -43,10 +42,23 @@ export class GithubInstance {
|
||||
});
|
||||
|
||||
try {
|
||||
const installation = (await this.octokit.apps.listInstallations()).data[0];
|
||||
if (!installation) {
|
||||
throw Error("App has no installations, cannot continue. Please ensure you've installed the app somewhere (https://github.com/settings/installations)");
|
||||
}
|
||||
log.info(`Using installation ${installation.id} (${installation.app_slug})`)
|
||||
this.internalOctokit = new Octokit({
|
||||
authStrategy: createAppAuth,
|
||||
auth: {
|
||||
...auth,
|
||||
installationId: installation.id,
|
||||
},
|
||||
userAgent: USER_AGENT,
|
||||
});
|
||||
await this.octokit.rateLimit.get();
|
||||
log.info("Auth check success");
|
||||
} catch (ex) {
|
||||
log.info("Auth check failed:", ex);
|
||||
log.warn("Auth check failed:", ex);
|
||||
throw Error("Attempting to verify GitHub authentication configration failed");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user