File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
packages/event-handler/src/appsync-events Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 1- import { EnvironmentVariablesService } from '@aws-lambda-powertools/commons' ;
21import type { GenericLogger } from '@aws-lambda-powertools/commons/types' ;
32import { isRecord } from '@aws-lambda-powertools/commons/typeutils' ;
3+ import { getStringFromEnv , isDevMode } from '@aws-lambda-powertools/commons/utils/env' ;
44import type {
55 OnPublishHandler ,
66 OnSubscribeHandler ,
@@ -31,14 +31,12 @@ class Router {
3131 * Whether the router is running in development mode.
3232 */
3333 protected readonly isDev : boolean = false ;
34- /**
35- * The environment variables service instance.
36- */
37- protected readonly envService : EnvironmentVariablesService ;
38-
34+
3935 public constructor ( options ?: RouterOptions ) {
40- this . envService = new EnvironmentVariablesService ( ) ;
41- const alcLogLevel = this . envService . get ( 'AWS_LAMBDA_LOG_LEVEL' ) ;
36+ const alcLogLevel = getStringFromEnv ( {
37+ key : 'AWS_LAMBDA_LOG_LEVEL' ,
38+ defaultValue : '' ,
39+ } ) ;
4240 this . logger = options ?. logger ?? {
4341 debug : alcLogLevel === 'DEBUG' ? console . debug : ( ) => undefined ,
4442 error : console . error ,
@@ -52,7 +50,7 @@ class Router {
5250 logger : this . logger ,
5351 eventType : 'onSubscribe' ,
5452 } ) ;
55- this . isDev = this . envService . isDevMode ( ) ;
53+ this . isDev = isDevMode ( ) ;
5654 }
5755
5856 /**
You can’t perform that action at this time.
0 commit comments