Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix merge conflicts

Tuan Dang409d46aa10e7
diff --cc backend/src/integrations/apps.ts
index 8d346dfa24,51cf43c45e..69810d025b
--- a/backend/src/integrations/apps.ts
+++ b/backend/src/integrations/apps.ts
@@@ -13,10 -10,10 +10,12 @@@ import
INTEGRATION_CIRCLECI_API_URL,
INTEGRATION_CLOUDFLARE_PAGES,
INTEGRATION_CLOUDFLARE_PAGES_API_URL,
+ INTEGRATION_CLOUD_66,
+ INTEGRATION_CLOUD_66_API_URL,
INTEGRATION_CODEFRESH,
INTEGRATION_CODEFRESH_API_URL,
+ INTEGRATION_DIGITAL_OCEAN_API_URL,
+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
INTEGRATION_FLYIO,
INTEGRATION_FLYIO_API_URL,
INTEGRATION_GITHUB,
@@@ -164,8 -164,10 +166,15 @@@ const getApps = async (
accessToken,
});
break;
+ case INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM:
- apps = await getAppsDigitalOceanAppPlatform({ accessToken });
++ apps = await getAppsDigitalOceanAppPlatform({
++ accessToken
++ });
++ break;
+ case INTEGRATION_CLOUD_66:
+ apps = await getAppsCloud66({
+ accessToken,
+ });
break;
}
@@@ -848,43 -849,63 +856,105 @@@ const getAppsCodefresh = async (
};
+/**
- * Return list of projects for Digital Ocean App Platform integration
++ * Return list of applications for DigitalOcean App Platform integration
++ * @param {Object} obj
++ * @param {String} obj.accessToken - personal access token for DigitalOcean
++ * @returns {Object[]} apps - names of DigitalOcean apps
++ * @returns {String} apps.name - name of DigitalOcean app
++ * @returns {String} apps.appId - id of DigitalOcean app
+ */
-
+const getAppsDigitalOceanAppPlatform = async ({ accessToken }: { accessToken: string }) => {
+ interface DigitalOceanApp {
+ id: string;
+ owner_uuid: string;
+ spec: Spec;
+ }
+
+ interface Spec {
+ name: string;
+ region: string;
+ envs: Env[];
+ }
+
+ interface Env {
+ key: string;
+ value: string;
+ scope: string;
+ }
+
+ const res = (
+ await standardRequest.get(`${INTEGRATION_DIGITAL_OCEAN_API_URL}/v2/apps`, {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Accept-Encoding": "application/json"
+ }
+ })
+ ).data;
-
++
+ return (res.apps ?? []).map((a: DigitalOceanApp) => ({
+ name: a.spec.name,
+ appId: a.id
+ }));
- };
++}
++
+ /**
+ * Return list of applications for Cloud66 integration
+ * @param {Object} obj
+ * @param {String} obj.accessToken - personal access token for Cloud66 API
+ * @returns {Object[]} apps - Cloud66 apps
+ * @returns {String} apps.name - name of Cloud66 app
+ * @returns {String} apps.appId - uid of Cloud66 app
+ */
+ const getAppsCloud66 = async ({ accessToken }: { accessToken: string }) => {
+ interface Cloud66Apps {
+ uid: string;
+ name: string;
+ account_id: number;
+ git: string;
+ git_branch: string;
+ environment: string;
+ cloud: string;
+ fqdn: string;
+ language: string;
+ framework: string;
+ status: number;
+ health: number;
+ last_activity: string;
+ last_activity_iso: string;
+ maintenance_mode: boolean;
+ has_loadbalancer: boolean;
+ created_at: string;
+ updated_at: string;
+ deploy_directory: string;
+ cloud_status: string;
+ backend: string;
+ version: string;
+ revision: string;
+ is_busy: boolean;
+ account_name: string;
+ is_cluster: boolean;
+ is_inside_cluster: boolean;
+ cluster_name: any;
+ application_address: string;
+ configstore_namespace: string;
+ }
+
+ const stacks = (
+ await standardRequest.get(`${INTEGRATION_CLOUD_66_API_URL}/3/stacks`, {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Accept-Encoding": "application/json"
+ }
+ })
+ ).data.response as Cloud66Apps[]
+ const apps = stacks.map((app) => ({
+ name: app.name,
+ appId: app.uid
+ }));
+
+ return apps;
+ };
export { getApps };
diff --cc backend/src/integrations/sync.ts
index 5da5531ff1,aef9c52fe5..9afb0e4c54
--- a/backend/src/integrations/sync.ts
+++ b/backend/src/integrations/sync.ts
@@@ -22,10 -18,10 +18,12 @@@ import
INTEGRATION_CIRCLECI_API_URL,
INTEGRATION_CLOUDFLARE_PAGES,
INTEGRATION_CLOUDFLARE_PAGES_API_URL,
+ INTEGRATION_CLOUD_66,
+ INTEGRATION_CLOUD_66_API_URL,
INTEGRATION_CODEFRESH,
INTEGRATION_CODEFRESH_API_URL,
+ INTEGRATION_DIGITAL_OCEAN_API_URL,
+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
INTEGRATION_FLYIO,
INTEGRATION_FLYIO_API_URL,
INTEGRATION_GITHUB,
@@@ -222,13 -222,13 +224,20 @@@ const syncSecrets = async (
accessToken,
});
break;
+ case INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM:
+ await syncSecretsDigitalOceanAppPlatform({
+ integration,
+ secrets,
+ accessToken,
+ });
+ break;
+ case INTEGRATION_CLOUD_66:
+ await syncSecretsCloud66({
+ integration,
+ secrets,
+ accessToken
+ });
+ break;
}
};
@@@ -2110,30 -2111,106 +2120,141 @@@ const syncSecretsCodefresh = async (
);
};
++/**
++ * Sync/push [secrets] to DigitalOcean App Platform application with name [integration.app]
++ * @param {Object} obj
++ * @param {IIntegration} obj.integration - integration details
++ * @param {IIntegrationAuth} obj.integrationAuth - integration auth details
++ * @param {Object} obj.secrets - secrets to push to integration (object where keys are secret keys and values are secret values)
++ * @param {String} obj.accessToken - personal access token for DigitalOcean
++ */
+const syncSecretsDigitalOceanAppPlatform = async ({
+ integration,
+ secrets,
+ accessToken
+}: {
+ integration: IIntegration;
+ secrets: any;
+ accessToken: string;
+}) => {
+ await standardRequest.put(
+ `${INTEGRATION_DIGITAL_OCEAN_API_URL}/v2/apps/${integration.appId}`,
+ {
+ spec: {
+ name: integration.app,
+ envs: Object.entries(secrets).map(([key, value]) => ({ key, value }))
+ }
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ }
+ }
+ );
++}
++
+ /**
+ * Sync/push [secrets] to Cloud66 application with name [integration.app]
+ * @param {Object} obj
+ * @param {IIntegration} obj.integration - integration details
+ * @param {IIntegrationAuth} obj.integrationAuth - integration auth details
+ * @param {Object} obj.secrets - secrets to push to integration (object where keys are secret keys and values are secret values)
+ * @param {String} obj.accessToken - access token for Cloud66 integration
+ */
+ const syncSecretsCloud66 = async ({
+ integration,
+ secrets,
+ accessToken
+ }: {
+ integration: IIntegration;
+ secrets: any;
+ accessToken: string;
+ }) => {
++
+ interface Cloud66Secret {
+ id: number;
+ key: string;
+ value: string;
+ readonly: boolean;
+ created_at: string;
+ updated_at: string;
+ is_password: boolean;
+ is_generated: boolean;
+ history: any[];
+ }
+
+ // get all current secrets
+ const res = (
+ await standardRequest.get(
+ `${INTEGRATION_CLOUD_66_API_URL}/3/stacks/${integration.appId}/environments`,
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ }
+ }
+ )
+ )
+ .data
+ .response
+ .filter((secret: Cloud66Secret) => !secret.readonly || !secret.is_generated)
+ .reduce(
+ (obj: any, secret: any) => ({
+ ...obj,
+ [secret.key]: secret
+ }),
+ {}
+ );
+
+ for await (const key of Object.keys(secrets)) {
+ if (key in res) {
+ // update existing secret
+ await standardRequest.put(
+ `${INTEGRATION_CLOUD_66_API_URL}/3/stacks/${integration.appId}/environments/${key}`,
+ {
+ key,
+ value: secrets[key]
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ }
+ }
+ );
+ } else {
+ // create new secret
+ await standardRequest.post(
+ `${INTEGRATION_CLOUD_66_API_URL}/3/stacks/${integration.appId}/environments`,
+ {
+ key,
+ value: secrets[key]
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ }
+ }
+ );
+ }
+ }
+
+ for await (const key of Object.keys(res)) {
+ if (!(key in secrets)) {
+ // delete secret
+ await standardRequest.delete(
+ `${INTEGRATION_CLOUD_66_API_URL}/3/stacks/${integration.appId}/environments/${key}`,
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ }
+ }
+ );
+ }
+ }
};
export { syncSecrets };
diff --cc backend/src/models/integration.ts
index bcaf4cd279,f3234b6168..e79e85ce91
--- a/backend/src/models/integration.ts
+++ b/backend/src/models/integration.ts
@@@ -7,8 -6,8 +6,9 @@@ import
INTEGRATION_CHECKLY,
INTEGRATION_CIRCLECI,
INTEGRATION_CLOUDFLARE_PAGES,
+ INTEGRATION_CLOUD_66,
INTEGRATION_CODEFRESH,
+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
INTEGRATION_FLYIO,
INTEGRATION_GITHUB,
INTEGRATION_GITLAB,
@@@ -60,7 -60,7 +61,8 @@@ export interface IIntegration
| "cloudflare-pages"
| "bitbucket"
| "codefresh"
+ | "digital-ocean-app-platform"
+ | "cloud-66"
integrationAuth: Types.ObjectId;
}
@@@ -151,8 -151,8 +153,9 @@@ const integrationSchema = new Schema<II
INTEGRATION_HASHICORP_VAULT,
INTEGRATION_CLOUDFLARE_PAGES,
INTEGRATION_BITBUCKET,
+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
- INTEGRATION_CODEFRESH
+ INTEGRATION_CODEFRESH,
+ INTEGRATION_CLOUD_66,
],
required: true,
},
diff --cc backend/src/models/integrationAuth.ts
index 31b9d39c80,b1f4e4c7e3..8d1ea1e568
--- a/backend/src/models/integrationAuth.ts
+++ b/backend/src/models/integrationAuth.ts
@@@ -9,8 -8,8 +8,9 @@@ import
INTEGRATION_BITBUCKET,
INTEGRATION_CIRCLECI,
INTEGRATION_CLOUDFLARE_PAGES,
+ INTEGRATION_CLOUD_66,
INTEGRATION_CODEFRESH,
+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
INTEGRATION_FLYIO,
INTEGRATION_GITHUB,
INTEGRATION_GITLAB,
@@@ -47,8 -47,8 +48,9 @@@ export interface IIntegrationAuth exten
| "checkly"
| "cloudflare-pages"
| "codefresh"
+ | "digital-ocean-app-platform"
- | "bitbucket";
+ | "bitbucket"
+ | "cloud-66";
teamId: string;
accountId: string;
url: string;
@@@ -95,8 -95,8 +97,9 @@@ const integrationAuthSchema = new Schem
INTEGRATION_HASHICORP_VAULT,
INTEGRATION_CLOUDFLARE_PAGES,
INTEGRATION_BITBUCKET,
+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
- INTEGRATION_CODEFRESH
+ INTEGRATION_CODEFRESH,
+ INTEGRATION_CLOUD_66,
],
required: true,
},
diff --cc backend/src/variables/integration.ts
index 1f5dfca1f5,c005ac7153..95c5b71166
--- a/backend/src/variables/integration.ts
+++ b/backend/src/variables/integration.ts
@@@ -29,7 -29,7 +29,8 @@@ export const INTEGRATION_HASHICORP_VAUL
export const INTEGRATION_CLOUDFLARE_PAGES = "cloudflare-pages";
export const INTEGRATION_BITBUCKET = "bitbucket";
export const INTEGRATION_CODEFRESH = "codefresh";
+export const INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM = "digital-ocean-app-platform";
+ export const INTEGRATION_CLOUD_66 = "cloud-66";
export const INTEGRATION_SET = new Set([
INTEGRATION_AZURE_KEY_VAULT,
INTEGRATION_HEROKU,
@@@ -47,8 -47,8 +48,9 @@@
INTEGRATION_HASHICORP_VAULT,
INTEGRATION_CLOUDFLARE_PAGES,
INTEGRATION_BITBUCKET,
+ INTEGRATION_DIGITAL_OCEAN_APP_PLATFORM,
- INTEGRATION_CODEFRESH
+ INTEGRATION_CODEFRESH,
+ INTEGRATION_CLOUD_66
]);
// integration types
@@@ -81,7 -81,7 +83,8 @@@ export const INTEGRATION_CHECKLY_API_UR
export const INTEGRATION_CLOUDFLARE_PAGES_API_URL = "https://api.cloudflare.com";
export const INTEGRATION_BITBUCKET_API_URL = "https://api.bitbucket.org";
export const INTEGRATION_CODEFRESH_API_URL = "https://g.codefresh.io/api";
+export const INTEGRATION_DIGITAL_OCEAN_API_URL = "https://api.digitalocean.com";
+ export const INTEGRATION_CLOUD_66_API_URL = "https://app.cloud66.com/api";
export const getIntegrationOptions = async () => {
const INTEGRATION_OPTIONS = [
@@@ -275,15 -275,15 +278,24 @@@
clientId: "",
docsLink: "",
},
+ {
+ name: "Digital Ocean App Platform",
+ slug: "digital-ocean-app-platform",
+ image: "Digital Ocean.png",
+ isAvailable: true,
+ type: "pat",
+ clientId: "",
+ docsLink: "",
+ },
+ {
+ name: "Cloud 66",
+ slug: "cloud-66",
+ image: "Cloud 66.png",
+ isAvailable: true,
+ type: "pat",
+ clientId: "",
+ docsLink: "",
+ },
]
return INTEGRATION_OPTIONS;
diff --cc frontend/public/data/frequentConstants.ts
index f07415e41b,9968608260..61490758e3
--- a/frontend/public/data/frequentConstants.ts
+++ b/frontend/public/data/frequentConstants.ts
@@@ -22,8 -22,8 +22,9 @@@ const integrationSlugNameMapping: Mappi
"hashicorp-vault": "Vault",
"cloudflare-pages": "Cloudflare Pages",
"codefresh": "Codefresh",
+ "digital-ocean-app-platform": "Digital Ocean App Platform",
- bitbucket: "BitBucket"
+ bitbucket: "BitBucket",
+ "cloud-66": "Cloud 66"
};
const envMapping: Mapping = {
diff --cc frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx
index 20c65a6adc,9a3316822b..7ec4a15a8d
--- a/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx
+++ b/frontend/src/views/IntegrationsPage/IntegrationPage.utils.tsx
@@@ -98,9 -98,9 +98,12 @@@ export const redirectForProviderAuth =
case "codefresh":
link = `${window.location.origin}/integrations/codefresh/authorize`;
break;
+ case "digital-ocean-app-platform":
+ link = `${window.location.origin}/integrations/digital-ocean-app-platform/authorize`;
+ break;
+ case "cloud-66":
+ link = `${window.location.origin}/integrations/cloud-66/authorize`;
+ break;
default:
break;
}