Skip to content

Commit b230687

Browse files
committed
fix(environment): prevent renaming of the default environment
- Updated the logic to disallow renaming the default environment while still allowing updates to its description and other properties. - Adjusted error message for clarity when attempting to rename the default environment.
1 parent b499cef commit b230687

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,11 @@ export const environmentRouter = createTRPCRouter({
256256
}
257257
const currentEnvironment = await findEnvironmentById(environmentId);
258258

259-
if (currentEnvironment.isDefault) {
259+
// Prevent renaming the default environment, but allow updating env and description
260+
if (currentEnvironment.isDefault && updateData.name !== undefined) {
260261
throw new TRPCError({
261262
code: "BAD_REQUEST",
262-
message: "You cannot update the default environment",
263+
message: "You cannot rename the default environment",
263264
});
264265
}
265266
if (

0 commit comments

Comments
 (0)