Skip to content

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

Refactor Northflank connection code and improve documentation

Your Namec3899a0e812c
diff --git a/backend/src/server/routes/v1/app-connection-routers/northflank-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/northflank-connection-router.ts
index f012bbad9b..1728a63809 100644
--- a/backend/src/server/routes/v1/app-connection-routers/northflank-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/northflank-connection-router.ts
@@ -51,4 +51,3 @@ export const registerNorthflankConnectionRouter = async (server: FastifyZodProvi
}
});
};
-
diff --git a/backend/src/services/app-connection/northflank/northflank-connection-fns.ts b/backend/src/services/app-connection/northflank/northflank-connection-fns.ts
index 1df52e6b4a..25177bd71d 100644
--- a/backend/src/services/app-connection/northflank/northflank-connection-fns.ts
+++ b/backend/src/services/app-connection/northflank/northflank-connection-fns.ts
@@ -50,15 +50,12 @@ export const listProjects = async (appConnection: TNorthflankConnection): Promis
data: {
data: { projects }
}
- } = await request.get<{ data: { projects: TNorthflankProject[] } }>(
- `${NORTHFLANK_API_URL}/v1/projects`,
- {
- headers: {
- Authorization: `Bearer ${credentials.apiToken}`,
- Accept: "application/json"
- }
+ } = await request.get<{ data: { projects: TNorthflankProject[] } }>(`${NORTHFLANK_API_URL}/v1/projects`, {
+ headers: {
+ Authorization: `Bearer ${credentials.apiToken}`,
+ Accept: "application/json"
}
- );
+ });
return projects;
} catch (error: unknown) {
@@ -74,4 +71,3 @@ export const listProjects = async (appConnection: TNorthflankConnection): Promis
});
}
};
-
diff --git a/backend/src/services/app-connection/northflank/northflank-connection-schemas.ts b/backend/src/services/app-connection/northflank/northflank-connection-schemas.ts
index 3b61773a3d..95be757f64 100644
--- a/backend/src/services/app-connection/northflank/northflank-connection-schemas.ts
+++ b/backend/src/services/app-connection/northflank/northflank-connection-schemas.ts
@@ -11,11 +11,7 @@ import {
import { NorthflankConnectionMethod } from "./northflank-connection-enums";
export const NorthflankConnectionApiTokenCredentialsSchema = z.object({
- apiToken: z
- .string()
- .trim()
- .min(1, "API Token required")
- .describe(AppConnections.CREDENTIALS.NORTHFLANK.apiToken)
+ apiToken: z.string().trim().min(1, "API Token required").describe(AppConnections.CREDENTIALS.NORTHFLANK.apiToken)
});
const BaseNorthflankConnectionSchema = BaseAppConnectionSchema.extend({
@@ -36,9 +32,9 @@ export const SanitizedNorthflankConnectionSchema = z.discriminatedUnion("method"
export const ValidateNorthflankConnectionCredentialsSchema = z.discriminatedUnion("method", [
z.object({
- method: z.literal(NorthflankConnectionMethod.ApiToken).describe(
- AppConnections.CREATE(AppConnection.Northflank).method
- ),
+ method: z
+ .literal(NorthflankConnectionMethod.ApiToken)
+ .describe(AppConnections.CREATE(AppConnection.Northflank).method),
credentials: NorthflankConnectionApiTokenCredentialsSchema.describe(
AppConnections.CREATE(AppConnection.Northflank).credentials
)
@@ -62,4 +58,3 @@ export const NorthflankConnectionListItemSchema = z.object({
app: z.literal(AppConnection.Northflank),
methods: z.nativeEnum(NorthflankConnectionMethod).array()
});
-
diff --git a/backend/src/services/app-connection/northflank/northflank-connection-service.ts b/backend/src/services/app-connection/northflank/northflank-connection-service.ts
index 45ce6bb5a1..bee3cad146 100644
--- a/backend/src/services/app-connection/northflank/northflank-connection-service.ts
+++ b/backend/src/services/app-connection/northflank/northflank-connection-service.ts
@@ -19,7 +19,7 @@ export const northflankConnectionService = (getAppConnection: TGetAppConnectionF
return projects;
} catch (error) {
- logger.error(error, "Failed to establish connection with Northflank");
+ logger.error({ error, connectionId, actor: actor.type }, "Failed to establish connection with Northflank");
return [];
}
};
@@ -28,4 +28,3 @@ export const northflankConnectionService = (getAppConnection: TGetAppConnectionF
listProjects
};
};
-
diff --git a/docs/integrations/app-connections/northflank.mdx b/docs/integrations/app-connections/northflank.mdx
index e4fa803f40..4e04811542 100644
--- a/docs/integrations/app-connections/northflank.mdx
+++ b/docs/integrations/app-connections/northflank.mdx
@@ -17,11 +17,11 @@ Infisical supports the use of [API Tokens](https://northflank.com/docs/v1/api/us
![Create API Role](/images/app-connections/northflank/step-1.png)
- Click in **Create API role**.
+ Click on **Create API role**.
![Create API Role](/images/app-connections/northflank/step-2.png)
- Select all the projects you want this role to have access, or leave this unchecked if you want to give access to all project.
+ Select all the projects you want this role to have access to, or leave this unchecked if you want to give access to all projects.
![Create API Role](/images/app-connections/northflank/step-3.png)
@@ -32,7 +32,7 @@ Infisical supports the use of [API Tokens](https://northflank.com/docs/v1/api/us
Scroll to the bottom and save the API role.
</Step>
<Step title="Create an API Token">
- Click on the **API** -> **Tokens** menu on the left and then in the **Create API token** button.
+ Click on the **API** -> **Tokens** menu on the left and then click the **Create API token** button.
![Create API Token](/images/app-connections/northflank/step-5.png)
@@ -84,7 +84,7 @@ Infisical supports the use of [API Tokens](https://northflank.com/docs/v1/api/us
```bash Request
curl --request POST \
- --url http://localhost:8080/api/v1/app-connections/northflank \
+ --url https://app.infisical.com/api/v1/app-connections/northflank \
--header 'Content-Type: application/json' \
--data '{
"name": "my-northflank-connection",
@@ -104,7 +104,7 @@ Infisical supports the use of [API Tokens](https://northflank.com/docs/v1/api/us
"id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"name": "my-northflank-connection",
"description": null,
- "projectId": "7ffbb072-2575-495a-b5b0-127f88caef78",
+ "projectId": "abcdef12-3456-7890-abcd-ef1234567890",
"version": 1,
"orgId": "abcdef12-3456-7890-abcd-ef1234567890",
"createdAt": "2025-01-23T10:15:00.000Z",
@@ -112,7 +112,6 @@ Infisical supports the use of [API Tokens](https://northflank.com/docs/v1/api/us
"isPlatformManagedCredentials": false,
"credentialsHash": "d41d8cd98f00b204e9800998ecf8427e",
"gatewayId":null,
- "projectId":"abcdef12-3456-7890-abcd-ef1234567890"
"app": "northflank",
"method": "api-token",
"credentials": {}
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/NorthflankConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/NorthflankConnectionForm.tsx
index 5befaa645a..2b837ce193 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/NorthflankConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/NorthflankConnectionForm.tsx
@@ -13,8 +13,8 @@ import {
import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";
import { AppConnection } from "@app/hooks/api/appConnections/enums";
import {
- TNorthflankConnection,
- NorthflankConnectionMethod
+ NorthflankConnectionMethod,
+ TNorthflankConnection
} from "@app/hooks/api/appConnections/types/northflank-connection";
import {
@@ -86,7 +86,7 @@ export const NorthflankConnectionForm = ({ appConnection, onSubmit }: Props) =>
{Object.values(NorthflankConnectionMethod).map((method) => {
return (
<SelectItem value={method} key={method}>
- {getAppConnectionMethodDetails(method).name}{" "}
+ {getAppConnectionMethodDetails(method).name}
</SelectItem>
);
})}
@@ -133,4 +133,3 @@ export const NorthflankConnectionForm = ({ appConnection, onSubmit }: Props) =>
</FormProvider>
);
};
-