Skip to content

Commit c366275

Browse files
batzz-00kuhe
andauthored
fix(rds-signer): don't overwrite default config with undefined values (#6166)
Co-authored-by: George Fu <[email protected]>
1 parent 14bb646 commit c366275

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { Sha256 } from "@aws-crypto/sha256-browser";
22
import { invalidProvider } from "@smithy/invalid-dependency";
33

4-
import { SignerConfig } from "./Signer";
4+
import type { SignerConfig } from "./Signer";
55

66
/**
77
* @internal
88
*/
99
export const getRuntimeConfig = (config: SignerConfig) => {
1010
return {
1111
runtime: "browser",
12-
sha256: config?.sha256 ?? Sha256,
13-
credentials: invalidProvider("Credential is missing"),
14-
region: invalidProvider("Region is missing"),
1512
...config,
13+
sha256: config?.sha256 ?? Sha256,
14+
credentials: config?.credentials ?? invalidProvider("Credential is missing"),
15+
region: config?.region ?? invalidProvider("Region is missing"),
1616
};
1717
};
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { Sha256 } from "@aws-crypto/sha256-js";
22
import { invalidProvider } from "@smithy/invalid-dependency";
33

4-
import { SignerConfig } from "./Signer";
4+
import type { SignerConfig } from "./Signer";
55

66
/**
77
* @internal
88
*/
99
export const getRuntimeConfig = (config: SignerConfig) => {
1010
return {
1111
runtime: "react-native",
12-
sha256: config?.sha256 ?? Sha256,
13-
credentials: invalidProvider("Credential is missing"),
14-
region: invalidProvider("Region is missing"),
1512
...config,
13+
sha256: config?.sha256 ?? Sha256,
14+
credentials: config?.credentials ?? invalidProvider("Credential is missing"),
15+
region: config?.region ?? invalidProvider("Region is missing"),
1616
};
1717
};

packages/rds-signer/src/runtimeConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@sm
33
import { Hash } from "@smithy/hash-node";
44
import { loadConfig } from "@smithy/node-config-provider";
55

6-
import { SignerConfig } from "./Signer";
6+
import type { SignerConfig } from "./Signer";
77

88
/**
99
* @internal
1010
*/
1111
export const getRuntimeConfig = (config: SignerConfig) => {
1212
return {
1313
runtime: "node",
14+
...config,
1415
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
1516
credentials:
1617
config?.credentials ??
@@ -23,6 +24,5 @@ export const getRuntimeConfig = (config: SignerConfig) => {
2324
...NODE_REGION_CONFIG_FILE_OPTIONS,
2425
profile: config.profile,
2526
}),
26-
...config,
2727
};
2828
};

0 commit comments

Comments
 (0)