mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 20:51:50 +00:00
feat(secret-sync): Add Heroku Secret Sync
This commit is contained in:
@@ -22,5 +22,6 @@ export enum AppConnection {
|
||||
LDAP = "ldap",
|
||||
TeamCity = "teamcity",
|
||||
OCI = "oci",
|
||||
OnePass = "1password"
|
||||
OnePass = "1password",
|
||||
Heroku = "heroku"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./queries";
|
||||
export * from "./types";
|
||||
@@ -0,0 +1,36 @@
|
||||
import { useQuery, UseQueryOptions } from "@tanstack/react-query";
|
||||
|
||||
import { apiRequest } from "@app/config/request";
|
||||
|
||||
import { appConnectionKeys } from "../queries";
|
||||
import { THerokuApp } from "./types";
|
||||
|
||||
const herokuConnectionKeys = {
|
||||
all: [...appConnectionKeys.all, "heroku"] as const,
|
||||
listApps: (connectionId: string) => [...herokuConnectionKeys.all, "apps", connectionId] as const
|
||||
};
|
||||
|
||||
export const useHerokuConnectionListApps = (
|
||||
connectionId: string,
|
||||
options?: Omit<
|
||||
UseQueryOptions<
|
||||
THerokuApp[],
|
||||
unknown,
|
||||
THerokuApp[],
|
||||
ReturnType<typeof herokuConnectionKeys.listApps>
|
||||
>,
|
||||
"queryKey" | "queryFn"
|
||||
>
|
||||
) => {
|
||||
return useQuery({
|
||||
queryKey: herokuConnectionKeys.listApps(connectionId),
|
||||
queryFn: async () => {
|
||||
const { data } = await apiRequest.get<THerokuApp[]>(
|
||||
`/api/v1/app-connections/heroku/${connectionId}/apps`
|
||||
);
|
||||
|
||||
return data;
|
||||
},
|
||||
...options
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
export type THerokuApp = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
@@ -106,6 +106,11 @@ export type TOCIConnectionOption = TAppConnectionOptionBase & {
|
||||
app: AppConnection.OCI;
|
||||
};
|
||||
|
||||
export type THerokuConnectionOption = TAppConnectionOptionBase & {
|
||||
app: AppConnection.Heroku;
|
||||
oauthClientId?: string;
|
||||
};
|
||||
|
||||
export type TOnePassConnectionOption = TAppConnectionOptionBase & {
|
||||
app: AppConnection.OnePass;
|
||||
};
|
||||
@@ -132,7 +137,8 @@ export type TAppConnectionOption =
|
||||
| THCVaultConnectionOption
|
||||
| TTeamCityConnectionOption
|
||||
| TOCIConnectionOption
|
||||
| TOnePassConnectionOption;
|
||||
| TOnePassConnectionOption
|
||||
| THerokuConnectionOption;
|
||||
|
||||
export type TAppConnectionOptionMap = {
|
||||
[AppConnection.AWS]: TAwsConnectionOption;
|
||||
@@ -159,4 +165,5 @@ export type TAppConnectionOptionMap = {
|
||||
[AppConnection.TeamCity]: TTeamCityConnectionOption;
|
||||
[AppConnection.OCI]: TOCIConnectionOption;
|
||||
[AppConnection.OnePass]: TOnePassConnectionOption;
|
||||
[AppConnection.Heroku]: THerokuConnectionOption;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { AppConnection } from "@app/hooks/api/appConnections/enums";
|
||||
import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
|
||||
|
||||
export enum HerokuConnectionMethod {
|
||||
AuthToken = "auth-token",
|
||||
OAuth = "oauth"
|
||||
}
|
||||
|
||||
export type THerokuConnection = TRootAppConnection & { app: AppConnection.Heroku } & (
|
||||
| {
|
||||
method: HerokuConnectionMethod.AuthToken;
|
||||
credentials: {
|
||||
authToken: string;
|
||||
};
|
||||
}
|
||||
| {
|
||||
method: HerokuConnectionMethod.OAuth;
|
||||
credentials: {
|
||||
code: string;
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -13,6 +13,7 @@ import { TGcpConnection } from "./gcp-connection";
|
||||
import { TGitHubConnection } from "./github-connection";
|
||||
import { TGitHubRadarConnection } from "./github-radar-connection";
|
||||
import { THCVaultConnection } from "./hc-vault-connection";
|
||||
import { THerokuConnection } from "./heroku-connection";
|
||||
import { THumanitecConnection } from "./humanitec-connection";
|
||||
import { TLdapConnection } from "./ldap-connection";
|
||||
import { TMsSqlConnection } from "./mssql-connection";
|
||||
@@ -38,6 +39,7 @@ export * from "./gcp-connection";
|
||||
export * from "./github-connection";
|
||||
export * from "./github-radar-connection";
|
||||
export * from "./hc-vault-connection";
|
||||
export * from "./heroku-connection";
|
||||
export * from "./humanitec-connection";
|
||||
export * from "./ldap-connection";
|
||||
export * from "./mssql-connection";
|
||||
@@ -74,7 +76,8 @@ export type TAppConnection =
|
||||
| TLdapConnection
|
||||
| TTeamCityConnection
|
||||
| TOCIConnection
|
||||
| TOnePassConnection;
|
||||
| TOnePassConnection
|
||||
| THerokuConnection;
|
||||
|
||||
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id">;
|
||||
|
||||
@@ -126,4 +129,5 @@ export type TAppConnectionMap = {
|
||||
[AppConnection.TeamCity]: TTeamCityConnection;
|
||||
[AppConnection.OCI]: TOCIConnection;
|
||||
[AppConnection.OnePass]: TOnePassConnection;
|
||||
[AppConnection.Heroku]: THerokuConnection;
|
||||
};
|
||||
|
||||
@@ -15,7 +15,8 @@ export enum SecretSync {
|
||||
HCVault = "hashicorp-vault",
|
||||
TeamCity = "teamcity",
|
||||
OCIVault = "oci-vault",
|
||||
OnePass = "1password"
|
||||
OnePass = "1password",
|
||||
Heroku = "heroku"
|
||||
}
|
||||
|
||||
export enum SecretSyncStatus {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { AppConnection } from "@app/hooks/api/appConnections/enums";
|
||||
import { SecretSync } from "@app/hooks/api/secretSyncs";
|
||||
import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
|
||||
|
||||
export type THerokuSync = TRootSecretSync & {
|
||||
destination: SecretSync.Heroku;
|
||||
destinationConfig: {
|
||||
app: string;
|
||||
appName: string;
|
||||
};
|
||||
connection: {
|
||||
app: AppConnection.Heroku;
|
||||
name: string;
|
||||
id: string;
|
||||
};
|
||||
};
|
||||
@@ -12,6 +12,7 @@ import { TDatabricksSync } from "./databricks-sync";
|
||||
import { TGcpSync } from "./gcp-sync";
|
||||
import { TGitHubSync } from "./github-sync";
|
||||
import { THCVaultSync } from "./hc-vault-sync";
|
||||
import { THerokuSync } from "./heroku-sync";
|
||||
import { THumanitecSync } from "./humanitec-sync";
|
||||
import { TOCIVaultSync } from "./oci-vault-sync";
|
||||
import { TTeamCitySync } from "./teamcity-sync";
|
||||
@@ -43,7 +44,8 @@ export type TSecretSync =
|
||||
| THCVaultSync
|
||||
| TTeamCitySync
|
||||
| TOCIVaultSync
|
||||
| TOnePassSync;
|
||||
| TOnePassSync
|
||||
| THerokuSync;
|
||||
|
||||
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user