Skip to content

Commit c218146

Browse files
committed
chore: add Node Config Options
1 parent b6b802a commit c218146

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

packages/middleware-flexible-checksums/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
},
2929
"license": "Apache-2.0",
3030
"dependencies": {
31+
"@smithy/node-config-provider": "^3.1.5",
3132
"@aws-crypto/crc32": "5.2.0",
3233
"@aws-crypto/crc32c": "5.2.0",
3334
"@aws-sdk/types": "*",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { LoadedConfigSelectors } from "@smithy/node-config-provider";
2+
3+
import { RequestChecksumCalculation } from "./constants";
4+
import { SelectorType, stringUnionSelector } from "./stringUnionSelector";
5+
6+
export const ENV_REQUEST_CHECKSUM_CALCULATION = "AWS_REQUEST_CHECKSUM_CALCULATION";
7+
export const CONFIG_REQUEST_CHECKSUM_CALCULATION = "request_checksum_calculation";
8+
export const DEFAULT_REQUEST_CHECKSUM_CALCULATION = RequestChecksumCalculation.WHEN_SUPPORTED;
9+
10+
export const NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS: LoadedConfigSelectors<string> = {
11+
environmentVariableSelector: (env) =>
12+
stringUnionSelector(env, ENV_REQUEST_CHECKSUM_CALCULATION, RequestChecksumCalculation, SelectorType.ENV),
13+
configFileSelector: (profile) =>
14+
stringUnionSelector(profile, CONFIG_REQUEST_CHECKSUM_CALCULATION, RequestChecksumCalculation, SelectorType.CONFIG),
15+
default: DEFAULT_REQUEST_CHECKSUM_CALCULATION,
16+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { LoadedConfigSelectors } from "@smithy/node-config-provider";
2+
3+
import { RequestChecksumCalculation } from "./constants";
4+
import { SelectorType, stringUnionSelector } from "./stringUnionSelector";
5+
6+
export const ENV_RESPONSE_CHECKSUM_VALIDATION = "AWS_RESPONSE_CHECKSUM_VALIDATION";
7+
export const CONFIG_RESPONSE_CHECKSUM_VALIDATION = "response_checksum_validation";
8+
export const DEFAULT_RESPONSE_CHECKSUM_VALIDATION = RequestChecksumCalculation.WHEN_SUPPORTED;
9+
10+
export const NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS: LoadedConfigSelectors<string> = {
11+
environmentVariableSelector: (env) =>
12+
stringUnionSelector(env, ENV_RESPONSE_CHECKSUM_VALIDATION, RequestChecksumCalculation, SelectorType.ENV),
13+
configFileSelector: (profile) =>
14+
stringUnionSelector(profile, CONFIG_RESPONSE_CHECKSUM_VALIDATION, RequestChecksumCalculation, SelectorType.CONFIG),
15+
default: DEFAULT_RESPONSE_CHECKSUM_VALIDATION,
16+
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export * from "./NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS";
2+
export * from "./NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS";
13
export * from "./constants";
24
export * from "./flexibleChecksumsMiddleware";
35
export * from "./getFlexibleChecksumsPlugin";

0 commit comments

Comments
 (0)