Skip to content

Commit 92c7f36

Browse files
BeckettFreysvozza
andauthored
refactor: idempotency env service to functions 4246 (#4314)
Co-authored-by: Stefano Vozza <svozza@amazon.com>
1 parent 6efb437 commit 92c7f36

File tree

7 files changed

+11
-407
lines changed

7 files changed

+11
-407
lines changed

packages/commons/src/config/EnvironmentVariablesService.ts

Lines changed: 0 additions & 110 deletions
This file was deleted.

packages/commons/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ if (!process.env.AWS_SDK_UA_APP_ID) {
55
}
66

77
export { addUserAgentMiddleware, isSdkClient } from './awsSdkUtils.js';
8-
export { EnvironmentVariablesService } from './config/EnvironmentVariablesService.js';
98
export { cleanupMiddlewares } from './middleware/cleanupMiddlewares.js';
109
export {
1110
IDEMPOTENCY_KEY,

packages/commons/tests/unit/EnvironmentVariablesService.test.ts

Lines changed: 0 additions & 193 deletions
This file was deleted.

packages/idempotency/src/IdempotencyConfig.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { getBooleanFromEnv } from '@aws-lambda-powertools/commons/utils/env';
12
import { PowertoolsFunctions } from '@aws-lambda-powertools/jmespath/functions';
23
import type { JMESPathParsingOptions } from '@aws-lambda-powertools/jmespath/types';
34
import type { Context } from 'aws-lambda';
4-
import { EnvironmentVariablesService } from './config/EnvironmentVariablesService.js';
55
import type {
66
IdempotencyConfigOptions,
77
ResponseHook,
@@ -64,7 +64,6 @@ class IdempotencyConfig {
6464
* Use the local cache to store idempotency keys.
6565
*/
6666
public useLocalCache: boolean;
67-
readonly #envVarsService: EnvironmentVariablesService;
6867
readonly #enabled: boolean = true;
6968

7069
public constructor(config: IdempotencyConfigOptions) {
@@ -80,8 +79,11 @@ class IdempotencyConfig {
8079
this.hashFunction = config.hashFunction ?? 'md5';
8180
this.lambdaContext = config.lambdaContext;
8281
this.responseHook = config.responseHook;
83-
this.#envVarsService = new EnvironmentVariablesService();
84-
this.#enabled = this.#envVarsService.getIdempotencyEnabled();
82+
this.#enabled = !getBooleanFromEnv({
83+
key: 'POWERTOOLS_IDEMPOTENCY_DISABLED',
84+
defaultValue: false,
85+
extendedParsing: true,
86+
});
8587
}
8688

8789
/**

packages/idempotency/src/config/EnvironmentVariablesService.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)