mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-19 22:25:22 +02:00
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.
This commit is contained in:
@@ -256,10 +256,11 @@ export const environmentRouter = createTRPCRouter({
|
||||
}
|
||||
const currentEnvironment = await findEnvironmentById(environmentId);
|
||||
|
||||
if (currentEnvironment.isDefault) {
|
||||
// Prevent renaming the default environment, but allow updating env and description
|
||||
if (currentEnvironment.isDefault && updateData.name !== undefined) {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "You cannot update the default environment",
|
||||
message: "You cannot rename the default environment",
|
||||
});
|
||||
}
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user