Skip to content

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

exclude PKI and PAM from billable projects

x0322053d3154775d0d
diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.ts
index d232f1f08a..3611f17f99 100644
--- a/backend/src/ee/services/license/license-service.ts
+++ b/backend/src/ee/services/license/license-service.ts
@@ -103,7 +103,7 @@ export const licenseServiceFactory = ({
data: { currentPlan }
} = await licenseServerOnPremApi.request.get<{ currentPlan: TFeatureSet }>("/api/license/v1/plan");
- const workspacesUsed = await projectDAL.countOfOrgProjects(null);
+ const workspacesUsed = await projectDAL.countBillableOrgProjects(null);
currentPlan.workspacesUsed = workspacesUsed;
const usedIdentitySeats = await licenseDAL.countOrgUsersAndIdentities(null);
@@ -215,7 +215,7 @@ export const licenseServiceFactory = ({
} = await licenseServerCloudApi.request.get<{ currentPlan: TFeatureSet }>(
`/api/license-server/v1/customers/${org.customerId}/cloud-plan`
);
- const workspacesUsed = await projectDAL.countOfOrgProjects(rootOrgId);
+ const workspacesUsed = await projectDAL.countBillableOrgProjects(rootOrgId);
currentPlan.workspacesUsed = workspacesUsed;
const membersUsed = await licenseDAL.countOfOrgMembers(rootOrgId);
@@ -475,7 +475,7 @@ export const licenseServiceFactory = ({
const [orgMembersUsed, identityUsed, projectCount] = await Promise.all([
orgDAL.countAllOrgMembers(orgId),
licenseDAL.countOfOrgIdentities(orgId),
- projectDAL.countOfOrgProjects(orgId)
+ projectDAL.countBillableOrgProjects(orgId)
]);
return {
diff --git a/backend/src/services/project/project-dal.ts b/backend/src/services/project/project-dal.ts
index af9fdb5096..5e9f584486 100644
--- a/backend/src/services/project/project-dal.ts
+++ b/backend/src/services/project/project-dal.ts
@@ -769,12 +769,13 @@ export const projectDALFactory = (db: TDbClient) => {
}
};
- const countOfOrgProjects = async (orgId: string | null, tx?: Knex) => {
+ const countBillableOrgProjects = async (orgId: string | null, tx?: Knex) => {
try {
const subOrgProjects = db.replicaNode()(TableName.Organization).where({ rootOrgId: orgId }).select("id");
const doc = await (tx || db.replicaNode())(TableName.Project)
.whereNull("deleteAfter")
+ .whereNotIn("type", [ProjectType.CertificateManager, ProjectType.PAM])
.andWhere((bd) => {
if (orgId) {
void bd.where({ orgId }).orWhereIn("orgId", subOrgProjects);
@@ -812,6 +813,6 @@ export const projectDALFactory = (db: TDbClient) => {
searchProjects,
findProjectByEnvId,
findProjectDeletedEnvironments,
- countOfOrgProjects
+ countBillableOrgProjects
};
};
diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.ts
index 90b36444ce..d2d8586cbe 100644
--- a/backend/src/services/project/project-service.ts
+++ b/backend/src/services/project/project-service.ts
@@ -303,7 +303,7 @@ export const projectServiceFactory = ({
// We count directly from the database to get the accurate count, not the cached plan value
const plan = await licenseService.getPlan(organization.id);
if (plan.workspaceLimit !== null && type === ProjectType.SecretManager) {
- const currentProjectCount = await projectDAL.countOfOrgProjects(organization.id, tx);
+ const currentProjectCount = await projectDAL.countBillableOrgProjects(organization.id, tx);
if (currentProjectCount >= plan.workspaceLimit) {
throw new BadRequestError({
message: "Failed to create workspace due to plan limit reached. Upgrade plan to add more workspaces."