mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-18 13:15:39 +00:00
Add Northflank sync features and enhance documentation
- Implemented new Northflank sync functionality, including routes for listing secret groups and managing syncs. - Added types and schemas for Northflank projects and secret groups to improve data handling. - Updated frontend components to support Northflank sync configuration and review. - Enhanced API documentation with detailed instructions for Northflank integration and usage. - Included new images and examples in the documentation for better clarity.
This commit is contained in:
@@ -5,7 +5,12 @@ import { BadRequestError } from "@app/lib/errors";
|
||||
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||
|
||||
import { NorthflankConnectionMethod } from "./northflank-connection-enums";
|
||||
import { TNorthflankConnection, TNorthflankConnectionConfig, TNorthflankProject } from "./northflank-connection-types";
|
||||
import {
|
||||
TNorthflankConnection,
|
||||
TNorthflankConnectionConfig,
|
||||
TNorthflankProject,
|
||||
TNorthflankSecretGroup
|
||||
} from "./northflank-connection-types";
|
||||
|
||||
const NORTHFLANK_API_URL = "https://api.northflank.com";
|
||||
|
||||
@@ -71,3 +76,39 @@ export const listProjects = async (appConnection: TNorthflankConnection): Promis
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const listSecretGroups = async (
|
||||
appConnection: TNorthflankConnection,
|
||||
projectId: string
|
||||
): Promise<TNorthflankSecretGroup[]> => {
|
||||
const { credentials } = appConnection;
|
||||
|
||||
try {
|
||||
const {
|
||||
data: {
|
||||
data: { secrets }
|
||||
}
|
||||
} = await request.get<{ data: { secrets: TNorthflankSecretGroup[] } }>(
|
||||
`${NORTHFLANK_API_URL}/v1/projects/${projectId}/secrets`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${credentials.apiToken}`,
|
||||
Accept: "application/json"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return secrets;
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof AxiosError) {
|
||||
throw new BadRequestError({
|
||||
message: `Failed to list Northflank secret groups: ${error.message || "Unknown error"}`
|
||||
});
|
||||
}
|
||||
|
||||
throw new BadRequestError({
|
||||
message: "Unable to list Northflank secret groups",
|
||||
error
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,8 +2,11 @@ import { logger } from "@app/lib/logger";
|
||||
import { OrgServiceActor } from "@app/lib/types";
|
||||
|
||||
import { AppConnection } from "../app-connection-enums";
|
||||
import { listProjects as getNorthflankProjects } from "./northflank-connection-fns";
|
||||
import { TNorthflankConnection } from "./northflank-connection-types";
|
||||
import {
|
||||
listProjects as getNorthflankProjects,
|
||||
listSecretGroups as getNorthflankSecretGroups
|
||||
} from "./northflank-connection-fns";
|
||||
import { TNorthflankConnection, TNorthflankSecretGroup } from "./northflank-connection-types";
|
||||
|
||||
type TGetAppConnectionFunc = (
|
||||
app: AppConnection,
|
||||
@@ -24,7 +27,24 @@ export const northflankConnectionService = (getAppConnection: TGetAppConnectionF
|
||||
}
|
||||
};
|
||||
|
||||
const listSecretGroups = async (
|
||||
connectionId: string,
|
||||
projectId: string,
|
||||
actor: OrgServiceActor
|
||||
): Promise<TNorthflankSecretGroup[]> => {
|
||||
const appConnection = await getAppConnection(AppConnection.Northflank, connectionId, actor);
|
||||
try {
|
||||
const secretGroups = await getNorthflankSecretGroups(appConnection, projectId);
|
||||
|
||||
return secretGroups;
|
||||
} catch (error) {
|
||||
logger.error({ error, connectionId, projectId, actor: actor.type }, "Failed to list Northflank secret groups");
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
listProjects
|
||||
listProjects,
|
||||
listSecretGroups
|
||||
};
|
||||
};
|
||||
|
||||
@@ -28,3 +28,8 @@ export type TNorthflankProject = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type TNorthflankSecretGroup = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user