mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 12:38:36 +00:00
Merge remote-tracking branch 'origin/main' into pki-revamp
This commit is contained in:
@@ -2,7 +2,6 @@ import net from "node:net";
|
||||
|
||||
import { ForbiddenError } from "@casl/ability";
|
||||
import * as x509 from "@peculiar/x509";
|
||||
import { CronJob } from "cron";
|
||||
|
||||
import { OrgMembershipRole, TRelays } from "@app/db/schemas";
|
||||
import { PgSqlLock } from "@app/keystore/keystore";
|
||||
@@ -891,7 +890,7 @@ export const gatewayV2ServiceFactory = ({
|
||||
});
|
||||
};
|
||||
|
||||
const $healthcheckNotify = async () => {
|
||||
const healthcheckNotify = async () => {
|
||||
const unhealthyGateways = await gatewayV2DAL.find({
|
||||
isHeartbeatStale: true
|
||||
});
|
||||
@@ -945,18 +944,6 @@ export const gatewayV2ServiceFactory = ({
|
||||
}
|
||||
};
|
||||
|
||||
const initializeHealthcheckNotify = async () => {
|
||||
logger.info("Setting up background notification process for gateway v2 health-checks");
|
||||
|
||||
await $healthcheckNotify();
|
||||
|
||||
// run every 5 minutes
|
||||
const job = new CronJob("*/5 * * * *", $healthcheckNotify);
|
||||
job.start();
|
||||
|
||||
return job;
|
||||
};
|
||||
|
||||
return {
|
||||
listGateways,
|
||||
registerGateway,
|
||||
@@ -965,6 +952,6 @@ export const gatewayV2ServiceFactory = ({
|
||||
deleteGatewayById,
|
||||
heartbeat,
|
||||
getPamSessionKey,
|
||||
initializeHealthcheckNotify
|
||||
healthcheckNotify
|
||||
};
|
||||
};
|
||||
|
||||
@@ -25,7 +25,9 @@ export const initializeHsmModule = (envConfig: Pick<TEnvConfig, "isHsmConfigured
|
||||
|
||||
logger.info("PKCS#11 module initialized");
|
||||
} catch (error) {
|
||||
if (error instanceof pkcs11js.Pkcs11Error && error.code === pkcs11js.CKR_CRYPTOKI_ALREADY_INITIALIZED) {
|
||||
logger.error(error, "Failed to initialize PKCS#11 module");
|
||||
|
||||
if ((error as { message?: string })?.message === "CKR_CRYPTOKI_ALREADY_INITIALIZED") {
|
||||
logger.info("Skipping HSM initialization because it's already initialized.");
|
||||
} else {
|
||||
logger.error(error, "Failed to initialize PKCS#11 module");
|
||||
|
||||
@@ -44,7 +44,7 @@ export const licenseDALFactory = (db: TDbClient) => {
|
||||
|
||||
// count org identities
|
||||
const identityDoc = await (tx || db.replicaNode())(TableName.Membership)
|
||||
.where({ status: OrgMembershipStatus.Accepted, scope: AccessScope.Organization })
|
||||
.where({ scope: AccessScope.Organization })
|
||||
.whereNotNull(`${TableName.Membership}.actorIdentityId`)
|
||||
.where((bd) => {
|
||||
if (orgId) {
|
||||
|
||||
@@ -2,7 +2,6 @@ import { isIP } from "node:net";
|
||||
|
||||
import { ForbiddenError } from "@casl/ability";
|
||||
import * as x509 from "@peculiar/x509";
|
||||
import { CronJob } from "cron";
|
||||
|
||||
import { OrgMembershipRole, TRelays } from "@app/db/schemas";
|
||||
import { PgSqlLock } from "@app/keystore/keystore";
|
||||
@@ -1209,7 +1208,7 @@ export const relayServiceFactory = ({
|
||||
return deletedRelay;
|
||||
};
|
||||
|
||||
const $healthcheckNotify = async () => {
|
||||
const healthcheckNotify = async () => {
|
||||
const unhealthyRelays = await relayDAL.find({
|
||||
isHeartbeatStale: true
|
||||
});
|
||||
@@ -1283,18 +1282,6 @@ export const relayServiceFactory = ({
|
||||
}
|
||||
};
|
||||
|
||||
const initializeHealthcheckNotify = async () => {
|
||||
logger.info("Setting up background notification process for relay health-checks");
|
||||
|
||||
await $healthcheckNotify();
|
||||
|
||||
// run every 5 minutes
|
||||
const job = new CronJob("*/5 * * * *", $healthcheckNotify);
|
||||
job.start();
|
||||
|
||||
return job;
|
||||
};
|
||||
|
||||
return {
|
||||
registerRelay,
|
||||
getCredentialsForGateway,
|
||||
@@ -1302,6 +1289,6 @@ export const relayServiceFactory = ({
|
||||
getRelays,
|
||||
deleteRelay,
|
||||
heartbeat,
|
||||
initializeHealthcheckNotify
|
||||
healthcheckNotify
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user