@@ -152,8 +152,6 @@ app.post('/api/nginx/apps', requireAuth, async (req, res) => {
152152 try {
153153 previous = await readConfig ( ) ;
154154 await addApp ( path , port ) ;
155- const test = await testConfig ( ) ;
156- if ( ! test . ok ) { await writeConfig ( previous ) ; return res . status ( 422 ) . json ( { ok : false , output : test . output } ) ; }
157155 await reloadNginx ( ) ;
158156 res . json ( { ok : true } ) ;
159157 } catch ( err ) {
@@ -170,8 +168,6 @@ app.delete('/api/nginx/apps', requireAuth, async (req, res) => {
170168 try {
171169 previous = await readConfig ( ) ;
172170 await removeApp ( path ) ;
173- const test = await testConfig ( ) ;
174- if ( ! test . ok ) { await writeConfig ( previous ) ; return res . status ( 422 ) . json ( { ok : false , output : test . output } ) ; }
175171 await reloadNginx ( ) ;
176172 res . json ( { ok : true } ) ;
177173 } catch ( err ) {
@@ -230,10 +226,7 @@ app.post('/api/deploy/clone', requireAuth, async (req, res) => {
230226 const parsedPort = port ? parseInt ( port , 10 ) : null ;
231227 await cloneApp ( name , url , nginxPath || null , parsedPort ) ;
232228 if ( nginxPath && parsedPort ) {
233- const previous = await readConfig ( ) ;
234229 await addApp ( nginxPath , parsedPort ) ;
235- const test = await testConfig ( ) ;
236- if ( ! test . ok ) { await writeConfig ( previous ) ; return res . status ( 422 ) . json ( { ok : false , output : test . output } ) ; }
237230 await reloadNginx ( ) ;
238231 }
239232 res . json ( { ok : true } ) ;
@@ -260,11 +253,8 @@ app.delete('/api/deploy/apps', requireAuth, async (req, res) => {
260253 try {
261254 const meta = await deleteApp ( name ) ;
262255 if ( meta . nginxPath ) {
263- const previous = await readConfig ( ) ;
264- await removeApp ( meta . nginxPath ) ;
265- const test = await testConfig ( ) ;
266- if ( ! test . ok ) { await writeConfig ( previous ) ; }
267- else { await reloadNginx ( ) ; }
256+ await removeApp ( meta . nginxPath ) . catch ( ( ) => { } ) ;
257+ await reloadNginx ( ) . catch ( ( ) => { } ) ;
268258 }
269259 res . json ( { ok : true } ) ;
270260 } catch ( err ) {
0 commit comments