misc: finalized variable names

This commit is contained in:
Sheen Capadngan
2024-10-15 18:17:57 +08:00
parent bdae136bed
commit 94b799e80b
8 changed files with 21 additions and 21 deletions

View File

@@ -37,7 +37,7 @@ CLIENT_ID_VERCEL=
CLIENT_ID_NETLIFY=
CLIENT_ID_GITHUB=
CLIENT_ID_GITHUB_APP=
CLIENT_SLUG_GITHUB=
CLIENT_SLUG_GITHUB_APP=
CLIENT_ID_GITLAB=
CLIENT_ID_BITBUCKET=
CLIENT_SECRET_HEROKU=
@@ -49,8 +49,8 @@ CLIENT_SECRET_GITLAB=
CLIENT_SECRET_BITBUCKET=
CLIENT_SLUG_VERCEL=
GITHUB_APP_PRIVATE_KEY=
GITHUB_APP_ID=
CLIENT_PRIVATE_KEY_GITHUB_APP=
CLIENT_APP_ID_GITHUB_APP=
# Sentry (optional) for monitoring errors
SENTRY_DSN=

View File

@@ -120,12 +120,12 @@ const envSchema = z
// github oauth
CLIENT_ID_GITHUB: zpStr(z.string().optional()),
CLIENT_SECRET_GITHUB: zpStr(z.string().optional()),
CLIENT_SLUG_GITHUB: zpStr(z.string().optional()),
CLIENT_SLUG_GITHUB_APP: zpStr(z.string().optional()),
// github app
CLIENT_ID_GITHUB_APP: zpStr(z.string().optional()),
CLIENT_SECRET_GITHUB_APP: zpStr(z.string().optional()),
GITHUB_APP_PRIVATE_KEY: zpStr(z.string().optional()),
GITHUB_APP_ID: z.coerce.number().optional(),
CLIENT_PRIVATE_KEY_GITHUB_APP: zpStr(z.string().optional()),
CLIENT_APP_ID_GITHUB_APP: z.coerce.number().optional(),
// azure
CLIENT_ID_AZURE: zpStr(z.string().optional()),

View File

@@ -257,8 +257,8 @@ const getAppsGithub = async ({
const octokit = new Octokit({
authStrategy: createAppAuth,
auth: {
appId: appCfg.GITHUB_APP_ID,
privateKey: appCfg.GITHUB_APP_PRIVATE_KEY,
appId: appCfg.CLIENT_APP_ID_GITHUB_APP,
privateKey: appCfg.CLIENT_PRIVATE_KEY_GITHUB_APP,
installationId: authMetadata.installationId
}
});

View File

@@ -647,8 +647,8 @@ export const integrationAuthServiceFactory = ({
octokit = new Octokit({
authStrategy: createAppAuth,
auth: {
appId: appCfg.GITHUB_APP_ID,
privateKey: appCfg.GITHUB_APP_PRIVATE_KEY,
appId: appCfg.CLIENT_APP_ID_GITHUB_APP,
privateKey: appCfg.CLIENT_PRIVATE_KEY_GITHUB_APP,
installationId
}
});
@@ -724,8 +724,8 @@ export const integrationAuthServiceFactory = ({
octokit = new Octokit({
authStrategy: createAppAuth,
auth: {
appId: appCfg.GITHUB_APP_ID,
privateKey: appCfg.GITHUB_APP_PRIVATE_KEY,
appId: appCfg.CLIENT_APP_ID_GITHUB_APP,
privateKey: appCfg.CLIENT_PRIVATE_KEY_GITHUB_APP,
installationId: authMetadata.installationId
}
});

View File

@@ -183,8 +183,8 @@ export const deleteGithubSecrets = async ({
octokit = new OctokitWithRetry({
authStrategy: createAppAuth,
auth: {
appId: appCfg.GITHUB_APP_ID,
privateKey: appCfg.GITHUB_APP_PRIVATE_KEY,
appId: appCfg.CLIENT_APP_ID_GITHUB_APP,
privateKey: appCfg.CLIENT_PRIVATE_KEY_GITHUB_APP,
installationId: authMetadata.installationId
}
});

View File

@@ -140,7 +140,7 @@ export const getIntegrationOptions = async () => {
isAvailable: true,
type: "oauth",
clientId: appCfg.CLIENT_ID_GITHUB,
clientSlug: appCfg.CLIENT_SLUG_GITHUB,
clientSlug: appCfg.CLIENT_SLUG_GITHUB_APP,
docsLink: ""
},
{

View File

@@ -1565,8 +1565,8 @@ const syncSecretsGitHub = async ({
octokit = new Octokit({
authStrategy: createAppAuth,
auth: {
appId: appCfg.GITHUB_APP_ID,
privateKey: appCfg.GITHUB_APP_PRIVATE_KEY,
appId: appCfg.CLIENT_APP_ID_GITHUB_APP,
privateKey: appCfg.CLIENT_PRIVATE_KEY_GITHUB_APP,
installationId: authMetadata.installationId
}
});

View File

@@ -249,7 +249,7 @@ const exchangeCodeGithub = async ({ code, installationId }: { code: string; inst
if (installationId) {
// handle app installations
const res = (
const oauthRes = (
await request.get<ExchangeCodeGithubResponse>(IntegrationUrls.GITHUB_TOKEN_URL, {
params: {
client_id: appCfg.CLIENT_ID_GITHUB_APP,
@@ -276,7 +276,7 @@ const exchangeCodeGithub = async ({ code, installationId }: { code: string; inst
}>(IntegrationUrls.GITHUB_USER_INSTALLATIONS, {
headers: {
Accept: "application/json",
Authorization: `Bearer ${res.access_token}`,
Authorization: `Bearer ${oauthRes.access_token}`,
"Accept-Encoding": "application/json"
}
})
@@ -293,14 +293,14 @@ const exchangeCodeGithub = async ({ code, installationId }: { code: string; inst
}
return {
accessToken: "",
accessToken: "", // for github app integrations, we only need the installationID from the metadata
refreshToken: null,
accessExpiresAt: null,
installationName: matchingInstallation.account.login
};
}
// handle normal oauth
// handle oauth github integration
const res = (
await request.get<ExchangeCodeGithubResponse>(IntegrationUrls.GITHUB_TOKEN_URL, {
params: {