mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-11 07:28:51 +00:00
Refactor Northflank connection code and improve documentation
- Cleaned up code formatting in Northflank connection functions and schemas for better readability. - Enhanced error logging in the Northflank connection service to include additional context. - Updated Northflank integration documentation for clarity and accuracy, including minor text corrections and URL adjustments. - Removed unnecessary whitespace in various files for consistency.
This commit is contained in:
@@ -51,4 +51,3 @@ export const registerNorthflankConnectionRouter = async (server: FastifyZodProvi
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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()
|
||||
});
|
||||
|
||||
|
||||
@@ -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
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user