File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
packages/logger/src/config Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,13 @@ interface ConfigServiceInterface {
22
22
*/
23
23
getCurrentEnvironment ( ) : string
24
24
25
+ /**
26
+ * It returns the value of the POWERTOOLS_DEV environment variable.
27
+ *
28
+ * @returns {boolean }
29
+ */
30
+ getDevMode ( ) : boolean
31
+
25
32
/**
26
33
* It returns the value of the POWERTOOLS_LOGGER_LOG_EVENT environment variable.
27
34
*
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ class EnvironmentVariablesService extends CommonEnvironmentVariablesService impl
20
20
// Reserved environment variables
21
21
private awsRegionVariable = 'AWS_REGION' ;
22
22
private currentEnvironmentVariable = 'ENVIRONMENT' ;
23
+ private devModeVariable = 'POWERTOOLS_DEV' ;
23
24
private functionNameVariable = 'AWS_LAMBDA_FUNCTION_NAME' ;
24
25
private functionVersionVariable = 'AWS_LAMBDA_FUNCTION_VERSION' ;
25
26
private logEventVariable = 'POWERTOOLS_LOGGER_LOG_EVENT' ;
@@ -45,6 +46,17 @@ class EnvironmentVariablesService extends CommonEnvironmentVariablesService impl
45
46
return this . get ( this . currentEnvironmentVariable ) ;
46
47
}
47
48
49
+ /**
50
+ * It returns the value of the POWERTOOLS_DEV environment variable.
51
+ *
52
+ * @returns {boolean }
53
+ */
54
+ public getDevMode ( ) : boolean {
55
+ const value = this . get ( this . devModeVariable ) ;
56
+
57
+ return value . toLowerCase ( ) === 'true' || value === '1' ;
58
+ }
59
+
48
60
/**
49
61
* It returns the value of the AWS_LAMBDA_FUNCTION_MEMORY_SIZE environment variable.
50
62
*
You can’t perform that action at this time.
0 commit comments