@@ -114,10 +114,14 @@ export const register = async (
114114 } )
115115 } )
116116
117- const workingDir = args . _ && args . _ . length > 0 ? path . resolve ( args . _ [ args . _ . length - 1 ] ) : undefined
118- const pluginApi = new PluginAPI ( logger , process . env . CS_PLUGIN , process . env . CS_PLUGIN_PATH , workingDir )
119- await pluginApi . loadPlugins ( )
120- pluginApi . mount ( app , wsApp )
117+ if ( ! process . env . CS_DISABLE_PLUGINS ) {
118+ const workingDir = args . _ && args . _ . length > 0 ? path . resolve ( args . _ [ args . _ . length - 1 ] ) : undefined
119+ const pluginApi = new PluginAPI ( logger , process . env . CS_PLUGIN , process . env . CS_PLUGIN_PATH , workingDir )
120+ await pluginApi . loadPlugins ( )
121+ pluginApi . mount ( app , wsApp )
122+ app . use ( "/api/applications" , apps . router ( pluginApi ) )
123+ wrapper . onDispose ( ( ) => pluginApi . dispose ( ) )
124+ }
121125
122126 app . use ( bodyParser . json ( ) )
123127 app . use ( bodyParser . urlencoded ( { extended : true } ) )
@@ -141,9 +145,6 @@ export const register = async (
141145 app . use ( "/static" , _static . router )
142146 app . use ( "/update" , update . router )
143147
144- app . use ( "/api/applications" , apps . router ( pluginApi ) )
145- wrapper . onDispose ( ( ) => pluginApi . dispose ( ) )
146-
147148 app . use ( ( ) => {
148149 throw new HttpError ( "Not Found" , HttpCode . NotFound )
149150 } )
0 commit comments