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' ;
2
1
import type { GenericLogger } from '@aws-lambda-powertools/commons/types' ;
3
2
import { isRecord } from '@aws-lambda-powertools/commons/typeutils' ;
3
+ import { getStringFromEnv , isDevMode } from '@aws-lambda-powertools/commons/utils/env' ;
4
4
import type {
5
5
OnPublishHandler ,
6
6
OnSubscribeHandler ,
@@ -31,14 +31,12 @@ class Router {
31
31
* Whether the router is running in development mode.
32
32
*/
33
33
protected readonly isDev : boolean = false ;
34
- /**
35
- * The environment variables service instance.
36
- */
37
- protected readonly envService : EnvironmentVariablesService ;
38
-
34
+
39
35
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
+ } ) ;
42
40
this . logger = options ?. logger ?? {
43
41
debug : alcLogLevel === 'DEBUG' ? console . debug : ( ) => undefined ,
44
42
error : console . error ,
@@ -52,7 +50,7 @@ class Router {
52
50
logger : this . logger ,
53
51
eventType : 'onSubscribe' ,
54
52
} ) ;
55
- this . isDev = this . envService . isDevMode ( ) ;
53
+ this . isDev = isDevMode ( ) ;
56
54
}
57
55
58
56
/**
You can’t perform that action at this time.
0 commit comments