mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 12:28:56 +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: {
|
credentials: {
|
||||||
refreshToken,
|
refreshToken,
|
||||||
authToken: data.access_token,
|
authToken: data.access_token,
|
||||||
expiresAt: new Date(Date.now() + data.expires_in)
|
expiresAt: new Date(Date.now() + data.expires_in - 60)
|
||||||
},
|
},
|
||||||
orgId,
|
orgId,
|
||||||
kmsService
|
kmsService
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ export const HerokuConnectionOAuthCredentialsSchema = z.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const HerokuConnectionOAuthOutputCredentialsSchema = z.object({
|
export const HerokuConnectionOAuthOutputCredentialsSchema = z.object({
|
||||||
authToken: z.string(),
|
authToken: z.string().trim(),
|
||||||
refreshToken: z.string(),
|
refreshToken: z.string().trim(),
|
||||||
expiresAt: z.date()
|
expiresAt: z.date()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,9 @@ export const herokuConnectionService = (
|
|||||||
const appConnection = await getAppConnection(AppConnection.Heroku, connectionId, actor);
|
const appConnection = await getAppConnection(AppConnection.Heroku, connectionId, actor);
|
||||||
try {
|
try {
|
||||||
const apps = await getHerokuApps({ appConnection, appConnectionDAL, kmsService });
|
const apps = await getHerokuApps({ appConnection, appConnectionDAL, kmsService });
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
||||||
return apps;
|
return apps;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(error, "Failed to establish connection with Heroku");
|
logger.error(error, `Failed to establish connection with Heroku for app ${connectionId}`);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,12 +41,15 @@ const getValidAuthToken = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getHerokuConfigVars = async ({ authToken, app }: THerokuListVariables): Promise<THerokuConfigVars> => {
|
const getHerokuConfigVars = async ({ authToken, app }: THerokuListVariables): Promise<THerokuConfigVars> => {
|
||||||
const { data } = await request.get<THerokuConfigVars>(`${IntegrationUrls.HEROKU_API_URL}/apps/${app}/config-vars`, {
|
const { data } = await request.get<THerokuConfigVars>(
|
||||||
|
`${IntegrationUrls.HEROKU_API_URL}/apps/${encodeURIComponent(app)}/config-vars`,
|
||||||
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${authToken}`,
|
Authorization: `Bearer ${authToken}`,
|
||||||
Accept: "application/vnd.heroku+json; version=3"
|
Accept: "application/vnd.heroku+json; version=3"
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ description: "Learn how to configure a Heroku Sync for Infisical."
|
|||||||
},
|
},
|
||||||
"destinationConfig": {
|
"destinationConfig": {
|
||||||
"app": "8dd25736052a4b50",
|
"app": "8dd25736052a4b50",
|
||||||
"appName": "my-app",
|
"appName": "my-app"
|
||||||
}
|
}
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
@@ -114,7 +114,8 @@ description: "Learn how to configure a Heroku Sync for Infisical."
|
|||||||
"lastRemoveMessage": null,
|
"lastRemoveMessage": null,
|
||||||
"lastRemovedAt": null,
|
"lastRemovedAt": null,
|
||||||
"syncOptions": {
|
"syncOptions": {
|
||||||
"initialSyncBehavior": "overwrite-destination"
|
"initialSyncBehavior": "overwrite-destination",
|
||||||
|
"disableSecretDeletion": true
|
||||||
},
|
},
|
||||||
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
"projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
|
||||||
"connection": {
|
"connection": {
|
||||||
|
|||||||
+1
@@ -27,6 +27,7 @@ export const HerokuSyncFields = () => {
|
|||||||
<SecretSyncConnectionField
|
<SecretSyncConnectionField
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
setValue("destinationConfig.app", "");
|
setValue("destinationConfig.app", "");
|
||||||
|
setValue("destinationConfig.appName", "");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { DatabricksSyncDestinationSchema } from "./databricks-sync-destination-s
|
|||||||
import { GcpSyncDestinationSchema } from "./gcp-sync-destination-schema";
|
import { GcpSyncDestinationSchema } from "./gcp-sync-destination-schema";
|
||||||
import { GitHubSyncDestinationSchema } from "./github-sync-destination-schema";
|
import { GitHubSyncDestinationSchema } from "./github-sync-destination-schema";
|
||||||
import { HCVaultSyncDestinationSchema } from "./hc-vault-sync-destination-schema";
|
import { HCVaultSyncDestinationSchema } from "./hc-vault-sync-destination-schema";
|
||||||
import { HerokuSyncDestinationSchema } from "./heroku-destination-schema";
|
import { HerokuSyncDestinationSchema } from "./heroku-sync-destination-schema";
|
||||||
import { HumanitecSyncDestinationSchema } from "./humanitec-sync-destination-schema";
|
import { HumanitecSyncDestinationSchema } from "./humanitec-sync-destination-schema";
|
||||||
import { OCIVaultSyncDestinationSchema } from "./oci-vault-sync-destination-schema";
|
import { OCIVaultSyncDestinationSchema } from "./oci-vault-sync-destination-schema";
|
||||||
import { TeamCitySyncDestinationSchema } from "./teamcity-sync-destination-schema";
|
import { TeamCitySyncDestinationSchema } from "./teamcity-sync-destination-schema";
|
||||||
|
|||||||
+1
-1
@@ -113,7 +113,7 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Redirect to Heroku OAuh
|
// Redirect to Heroku OAuth
|
||||||
const oauthUrl = new URL("https://id.heroku.com/oauth/authorize");
|
const oauthUrl = new URL("https://id.heroku.com/oauth/authorize");
|
||||||
oauthUrl.searchParams.set("client_id", oauthClientId);
|
oauthUrl.searchParams.set("client_id", oauthClientId);
|
||||||
oauthUrl.searchParams.set("response_type", "code");
|
oauthUrl.searchParams.set("response_type", "code");
|
||||||
|
|||||||
Reference in New Issue
Block a user