mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-01-11 19:56:44 +00:00
feat: update GitHub App configuration to use GitHubAppName instead of GitHubAppClientId
This commit is contained in:
parent
8635726344
commit
64947413b0
9 changed files with 21 additions and 7 deletions
|
|
@ -7,7 +7,7 @@ import Response from "../Utils/Response";
|
|||
import BadDataException from "../../Types/Exception/BadDataException";
|
||||
import logger from "../Utils/Logger";
|
||||
import { JSONObject } from "../../Types/JSON";
|
||||
import { DashboardClientUrl, GitHubAppClientId } from "../EnvironmentConfig";
|
||||
import { DashboardClientUrl, GitHubAppName } from "../EnvironmentConfig";
|
||||
import ObjectID from "../../Types/ObjectID";
|
||||
import GitHubUtil, {
|
||||
GitHubRepository,
|
||||
|
|
@ -116,12 +116,12 @@ export default class GitHubAPI {
|
|||
"/github/auth/install",
|
||||
async (req: ExpressRequest, res: ExpressResponse) => {
|
||||
try {
|
||||
if (!GitHubAppClientId) {
|
||||
if (!GitHubAppName) {
|
||||
return Response.sendErrorResponse(
|
||||
req,
|
||||
res,
|
||||
new BadDataException(
|
||||
"GitHub App is not configured. Please set GITHUB_APP_CLIENT_ID.",
|
||||
"GitHub App is not configured. Please set GITHUB_APP_NAME.",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ export default class GitHubAPI {
|
|||
JSON.stringify({ projectId, userId }),
|
||||
).toString("base64");
|
||||
|
||||
const installUrl: string = `https://github.com/apps/${GitHubAppClientId}/installations/new?state=${state}`;
|
||||
const installUrl: string = `https://github.com/apps/${GitHubAppName}/installations/new?state=${state}`;
|
||||
|
||||
return Response.redirect(req, res, URL.fromString(installUrl));
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ const FRONTEND_ENV_ALLOW_LIST: Array<string> = [
|
|||
"SLACK_APP_CLIENT_ID",
|
||||
"MICROSOFT_TEAMS_APP_CLIENT_ID",
|
||||
"GITHUB_APP_CLIENT_ID",
|
||||
"GITHUB_APP_NAME",
|
||||
"CAPTCHA_ENABLED",
|
||||
"CAPTCHA_SITE_KEY",
|
||||
];
|
||||
|
|
@ -461,6 +462,8 @@ export const MicrosoftTeamsAppTenantId: string | null =
|
|||
|
||||
// GitHub App Configuration
|
||||
export const GitHubAppId: string | null = process.env["GITHUB_APP_ID"] || null;
|
||||
export const GitHubAppName: string | null =
|
||||
process.env["GITHUB_APP_NAME"] || null;
|
||||
export const GitHubAppClientId: string | null =
|
||||
process.env["GITHUB_APP_CLIENT_ID"] || null;
|
||||
export const GitHubAppClientSecret: string | null =
|
||||
|
|
|
|||
|
|
@ -256,3 +256,5 @@ export const MicrosoftTeamsAppClientId: string | null =
|
|||
|
||||
export const GitHubAppClientId: string | null =
|
||||
env("GITHUB_APP_CLIENT_ID") || null;
|
||||
|
||||
export const GitHubAppName: string | null = env("GITHUB_APP_NAME") || null;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import React, {
|
|||
useState,
|
||||
} from "react";
|
||||
import { FormStep } from "Common/UI/Components/Forms/Types/FormStep";
|
||||
import { GitHubAppClientId, HOME_URL } from "Common/UI/Config";
|
||||
import { GitHubAppName, HOME_URL } from "Common/UI/Config";
|
||||
import UserUtil from "Common/UI/Utils/User";
|
||||
import GitHubRepoSelectorModal from "../../Components/CodeRepository/GitHubRepoSelectorModal";
|
||||
import Button, { ButtonStyleType } from "Common/UI/Components/Button/Button";
|
||||
|
|
@ -76,7 +76,7 @@ const CodeRepositoryPage: FunctionComponent<
|
|||
setRefreshToggle(Date.now().toString());
|
||||
};
|
||||
|
||||
const isGitHubAppConfigured: boolean = Boolean(GitHubAppClientId);
|
||||
const isGitHubAppConfigured: boolean = Boolean(GitHubAppName);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ Usage:
|
|||
value: {{ $.Values.slackApp.clientId | quote }}
|
||||
- name: GITHUB_APP_ID
|
||||
value: {{ $.Values.gitHubApp.id | quote }}
|
||||
- name: GITHUB_APP_NAME
|
||||
value: {{ $.Values.gitHubApp.name | quote }}
|
||||
- name: GITHUB_APP_CLIENT_ID
|
||||
value: {{ $.Values.gitHubApp.clientId | quote }}
|
||||
- name: HOST
|
||||
|
|
|
|||
|
|
@ -2062,6 +2062,9 @@
|
|||
"id": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"name": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"clientId": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -833,16 +833,18 @@ microsoftTeamsApp:
|
|||
# GitHub Example Configuration
|
||||
# gitHubApp:
|
||||
# id: "123456"
|
||||
# name: "my-github-app"
|
||||
# clientId: "Iv1.abc123"
|
||||
# clientSecret: "your-client-secret"
|
||||
# privateKey: |
|
||||
# -----BEGIN RSA PRIVATE KEY-----
|
||||
# ...
|
||||
# -----END RSA PRIVATE KEY-----
|
||||
# webhookSecret: "your-webhook-secret"
|
||||
# webhookSecret: "your-webhook-secret"
|
||||
|
||||
gitHubApp:
|
||||
id:
|
||||
name:
|
||||
clientId:
|
||||
clientSecret:
|
||||
privateKey:
|
||||
|
|
|
|||
|
|
@ -360,6 +360,7 @@ MICROSOFT_TEAMS_APP_TENANT_ID=
|
|||
# Create a GitHub App at https://github.com/settings/apps
|
||||
# Required for connecting GitHub repositories to OneUptime
|
||||
GITHUB_APP_ID=
|
||||
GITHUB_APP_NAME=
|
||||
GITHUB_APP_CLIENT_ID=
|
||||
GITHUB_APP_CLIENT_SECRET=
|
||||
GITHUB_APP_PRIVATE_KEY=
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ x-common-runtime-variables: &common-runtime-variables
|
|||
|
||||
# GitHub App Configuration
|
||||
GITHUB_APP_ID: ${GITHUB_APP_ID}
|
||||
GITHUB_APP_NAME: ${GITHUB_APP_NAME}
|
||||
GITHUB_APP_CLIENT_ID: ${GITHUB_APP_CLIENT_ID}
|
||||
GITHUB_APP_CLIENT_SECRET: ${GITHUB_APP_CLIENT_SECRET}
|
||||
GITHUB_APP_PRIVATE_KEY: ${GITHUB_APP_PRIVATE_KEY}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue