@@ -12,9 +12,14 @@ const { StatusCodes, getReasonPhrase } = require("http-status-codes");
1212const toggles = require ( "@cap-js-community/feature-toggle-library" ) ;
1313const { config : eventQueueConfig } = require ( "@cap-js-community/event-queue" ) ;
1414
15- const { mergeDeep , toObject } = require ( "./src/util/helper" ) ;
15+ const { merge , toObject } = require ( "./src/util/helper" ) ;
1616
17- const config = mergeDeep ( require ( "./config" ) , cds . env . requires ?. [ "sap-afc-sdk" ] ?. config ?? { } ) ;
17+ const config = merge ( require ( "./config.json" ) , cds . env . requires ?. [ "sap-afc-sdk" ] ?. config ?? { } ) ;
18+
19+ // Plugins
20+ for ( const plugin of config . plugins ) {
21+ require ( `${ plugin } /cds-plugin` ) ;
22+ }
1823
1924const SERVER_SUFFIX = "srv" ;
2025const APPROUTER_SUFFIX = "approuter" ;
@@ -139,7 +144,7 @@ function serveBroker() {
139144 let brokerConfig = toObject ( cds . env . requires ?. [ "sap-afc-sdk" ] ?. broker ) ;
140145 const brokerPath = path . join ( cds . root , config . paths . broker ) ;
141146 try {
142- brokerConfig = mergeDeep ( require ( brokerPath ) , brokerConfig ) ;
147+ brokerConfig = merge ( require ( brokerPath ) , brokerConfig ) ;
143148 } catch ( err ) {
144149 if ( Object . keys ( brokerConfig ) . length === 0 ) {
145150 cds . log ( "/broker" ) . info ( `broker.json not found at '${ brokerPath } '. Call 'afc add broker'` ) ;
@@ -260,7 +265,7 @@ function serveMergedAppConfig(packageRoot, uiPath) {
260265 inbound . resolutionResult . url = `${ uiPath } /${ inbound . resolutionResult . url } ` ;
261266 }
262267 }
263- const mergedFioriSandboxConfig = mergeDeep ( packageFioriSandboxConfig , projectFioriSandboxConfig ) ;
268+ const mergedFioriSandboxConfig = merge ( packageFioriSandboxConfig , projectFioriSandboxConfig ) ;
264269 res . send ( mergedFioriSandboxConfig ) ;
265270 } ) ;
266271}
@@ -414,7 +419,7 @@ function outboxServices() {
414419}
415420
416421function handleFeatureToggles ( ) {
417- // event-queue
422+ // Event-Queue
418423 for ( const name in config . toggles . eventQueue ) {
419424 const toggle = config . toggles . eventQueue [ name ] ;
420425 eventQueueConfig [ name ] = toggles . getFeatureValue ( toggle ) ;
0 commit comments