mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-18 01:45:17 +00: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);
|
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({
|
throw new TRPCError({
|
||||||
code: "BAD_REQUEST",
|
code: "BAD_REQUEST",
|
||||||
message: "You cannot update the default environment",
|
message: "You cannot rename the default environment",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user