@@ -5,7 +5,7 @@ import { paths } from "@dokploy/server/constants";
55import type { Domain } from "@dokploy/server/services/domain" ;
66import { parse , stringify } from "yaml" ;
77import { encodeBase64 } from "../docker/utils" ;
8- import { execAsyncRemote } from "../process/execAsync" ;
8+ import { execAsync , execAsyncRemote } from "../process/execAsync" ;
99import type { FileConfig , HttpLoadBalancerService } from "./file-types" ;
1010
1111export const createTraefikConfig = ( appName : string ) => {
@@ -57,18 +57,16 @@ export const removeTraefikConfig = async (
5757 try {
5858 const { DYNAMIC_TRAEFIK_PATH } = paths ( ! ! serverId ) ;
5959 const configPath = path . join ( DYNAMIC_TRAEFIK_PATH , `${ appName } .yml` ) ;
60+ const command = `rm -f ${ configPath } ` ;
6061
6162 if ( serverId ) {
62- await execAsyncRemote ( serverId , `rm ${ configPath } ` ) ;
63+ await execAsyncRemote ( serverId , command ) ;
6364 } else {
64- if ( fs . existsSync ( configPath ) ) {
65- await fs . promises . unlink ( configPath ) ;
66- }
67- }
68- if ( fs . existsSync ( configPath ) ) {
69- await fs . promises . unlink ( configPath ) ;
65+ await execAsync ( command ) ;
7066 }
71- } catch { }
67+ } catch ( error ) {
68+ console . error ( `Error removing traefik config for ${ appName } :` , error ) ;
69+ }
7270} ;
7371
7472export const removeTraefikConfigRemote = async (
@@ -78,8 +76,13 @@ export const removeTraefikConfigRemote = async (
7876 try {
7977 const { DYNAMIC_TRAEFIK_PATH } = paths ( true ) ;
8078 const configPath = path . join ( DYNAMIC_TRAEFIK_PATH , `${ appName } .yml` ) ;
81- await execAsyncRemote ( serverId , `rm ${ configPath } ` ) ;
82- } catch { }
79+ await execAsyncRemote ( serverId , `rm -f ${ configPath } ` ) ;
80+ } catch ( error ) {
81+ console . error (
82+ `Error removing remote traefik config for ${ appName } :` ,
83+ error ,
84+ ) ;
85+ }
8386} ;
8487
8588export const loadOrCreateConfig = ( appName : string ) : FileConfig => {
0 commit comments