File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
apps/dokploy/server/api/routers Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff 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 ,
@@ -256,10 +264,11 @@ export const environmentRouter = createTRPCRouter({
256264 }
257265 const currentEnvironment = await findEnvironmentById ( environmentId ) ;
258266
259- if ( currentEnvironment . isDefault ) {
267+ // Prevent renaming the default environment, but allow updating env and description
268+ if ( currentEnvironment . isDefault && updateData . name !== undefined ) {
260269 throw new TRPCError ( {
261270 code : "BAD_REQUEST" ,
262- message : "You cannot update the default environment" ,
271+ message : "You cannot rename the default environment" ,
263272 } ) ;
264273 }
265274 if (
You can’t perform that action at this time.
0 commit comments