mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 17:28:26 +00:00
feat(secret-sync): Add PR suggestions for Heroku Integration
This commit is contained in:
@@ -86,7 +86,7 @@ export const refreshHerokuToken = async (
|
||||
credentials: {
|
||||
refreshToken,
|
||||
authToken: data.access_token,
|
||||
expiresAt: new Date(Date.now() + data.expires_in)
|
||||
expiresAt: new Date(Date.now() + data.expires_in - 60)
|
||||
},
|
||||
orgId,
|
||||
kmsService
|
||||
|
||||
@@ -19,8 +19,8 @@ export const HerokuConnectionOAuthCredentialsSchema = z.object({
|
||||
});
|
||||
|
||||
export const HerokuConnectionOAuthOutputCredentialsSchema = z.object({
|
||||
authToken: z.string(),
|
||||
refreshToken: z.string(),
|
||||
authToken: z.string().trim(),
|
||||
refreshToken: z.string().trim(),
|
||||
expiresAt: z.date()
|
||||
});
|
||||
|
||||
|
||||
@@ -22,10 +22,9 @@ export const herokuConnectionService = (
|
||||
const appConnection = await getAppConnection(AppConnection.Heroku, connectionId, actor);
|
||||
try {
|
||||
const apps = await getHerokuApps({ appConnection, appConnectionDAL, kmsService });
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return apps;
|
||||
} catch (error) {
|
||||
logger.error(error, "Failed to establish connection with Heroku");
|
||||
logger.error(error, `Failed to establish connection with Heroku for app ${connectionId}`);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -41,12 +41,15 @@ const getValidAuthToken = async (
|
||||
};
|
||||
|
||||
const getHerokuConfigVars = async ({ authToken, app }: THerokuListVariables): Promise<THerokuConfigVars> => {
|
||||
const { data } = await request.get<THerokuConfigVars>(`${IntegrationUrls.HEROKU_API_URL}/apps/${app}/config-vars`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
Accept: "application/vnd.heroku+json; version=3"
|
||||
const { data } = await request.get<THerokuConfigVars>(
|
||||
`${IntegrationUrls.HEROKU_API_URL}/apps/${encodeURIComponent(app)}/config-vars`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
Accept: "application/vnd.heroku+json; version=3"
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user