This repository was archived by the owner on Jun 13, 2023. It is now read-only.
File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,10 @@ export default class ServerlessEpsagonPlugin {
263
263
// eslint-disable-next-line no-param-reassign
264
264
func . epsagon . wrapper = this . config ( ) . wrapper ;
265
265
}
266
- const handlerCode = generateWrapperCode ( func , this . config ( ) ) ;
266
+
267
+ const handlerCode = generateWrapperCode ( func , this . config ( {
268
+ funcName : func . key ,
269
+ } ) ) ;
267
270
await writeFile (
268
271
join (
269
272
handlersFullDirPath ,
@@ -303,11 +306,17 @@ export default class ServerlessEpsagonPlugin {
303
306
* Gets the plugin config.
304
307
* @returns {Object } The config object
305
308
*/
306
- config ( ) {
307
- return Object . assign ( {
309
+ config ( { funcName = '' } = { } ) {
310
+ const funcs = this . sls . service . functions || { } ;
311
+ const funcConfig = ( funcs [ funcName ] || { } ) . epsagon || { } ;
312
+ const epsagonConfig = ( this . sls . service . custom || { } ) . epsagon || { } ;
313
+
314
+ return {
308
315
metadataOnly : 'false' ,
309
316
handlersDirName : 'epsagon_handlers' ,
310
- } , ( this . sls . service . custom || { } ) . epsagon || { } ) ;
317
+ ...epsagonConfig ,
318
+ ...funcConfig ,
319
+ } ;
311
320
}
312
321
313
322
/**
You can’t perform that action at this time.
0 commit comments