Skip to content

Commit 1c83919

Browse files
committed
fix(environment): prevent deletion of the default environment
- Added logic to disallow deletion of the default environment, throwing a BAD_REQUEST error if an attempt is made to delete it.
1 parent b230687 commit 1c83919

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

apps/dokploy/server/api/routers/environment.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ export const environmentRouter = createTRPCRouter({
208208
});
209209
}
210210

211+
// Prevent deletion of the default environment
212+
if (environment.isDefault) {
213+
throw new TRPCError({
214+
code: "BAD_REQUEST",
215+
message: "You cannot delete the default environment",
216+
});
217+
}
218+
211219
// Check environment deletion permission
212220
await checkEnvironmentDeletionPermission(
213221
ctx.user.id,

0 commit comments

Comments
 (0)