File tree Expand file tree Collapse file tree 3 files changed +39
-6
lines changed Expand file tree Collapse file tree 3 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ type DsqlSignerAction = "DbConnect" | "DbConnectAdmin";
1212
1313export interface DsqlSignerConfig {
1414 /**
15- * The AWS credentials to sign requests with. Uses the default credential provider chain if not specified.
15+ * The AWS credentials to sign requests with.
16+ * Uses the default credential provider chain if not specified.
1617 */
1718 credentials ?: AwsCredentialIdentity | AwsCredentialIdentityProvider ;
1819
@@ -22,7 +23,8 @@ export interface DsqlSignerConfig {
2223 hostname : string ;
2324
2425 /**
25- * The region the database is located in. Uses the region inferred from the runtime if omitted.
26+ * The region the database is located in.
27+ * Uses the region from the profile or inferred from the runtime if omitted.
2628 */
2729 region ?: string ;
2830
@@ -35,6 +37,16 @@ export interface DsqlSignerConfig {
3537 * The amount of time in seconds the generated token is valid.
3638 */
3739 expiresIn ?: number ;
40+
41+ /**
42+ * Optional. Can be provided to configure region from a profile
43+ * if operating in an environment with a file system having
44+ * an AWS configuration file.
45+ *
46+ * The credentials will also resolve based on this profile, if using
47+ * a credentials provider that includes the AWS configuration file.
48+ */
49+ profile ?: string ;
3850}
3951
4052/**
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
1313
1414export interface SignerConfig {
1515 /**
16- * The AWS credentials to sign requests with. Uses the default credential provider chain if not specified.
16+ * The AWS credentials to sign requests with.
17+ * Uses the default credential provider chain if not specified.
1718 */
1819 credentials ?: AwsCredentialIdentity | AwsCredentialIdentityProvider ;
1920 /**
@@ -25,7 +26,9 @@ export interface SignerConfig {
2526 */
2627 port : number ;
2728 /**
28- * The region the database is located in. Uses the region inferred from the runtime if omitted.
29+ * The region the database is located in.
30+ * Uses the region of the given profile or inferred from the runtime if
31+ * both are omitted.
2932 */
3033 region ?: string ;
3134 /**
@@ -36,6 +39,15 @@ export interface SignerConfig {
3639 * The username to login as.
3740 */
3841 username : string ;
42+ /**
43+ * Optional. Can be provided to configure region from a profile
44+ * if operating in an environment with a file system having
45+ * an AWS configuration file.
46+ *
47+ * The credentials will also resolve based on this profile, if using
48+ * a credentials provider that includes the AWS configuration file.
49+ */
50+ profile ?: string ;
3951}
4052
4153/**
Original file line number Diff line number Diff line change @@ -12,8 +12,17 @@ export const getRuntimeConfig = (config: SignerConfig) => {
1212 return {
1313 runtime : "node" ,
1414 sha256 : config ?. sha256 ?? Hash . bind ( null , "sha256" ) ,
15- credentials : config ?. credentials ?? fromNodeProviderChain ( ) ,
16- region : config ?. region ?? loadConfig ( NODE_REGION_CONFIG_OPTIONS , NODE_REGION_CONFIG_FILE_OPTIONS ) ,
15+ credentials :
16+ config ?. credentials ??
17+ fromNodeProviderChain ( {
18+ profile : config . profile ,
19+ } ) ,
20+ region :
21+ config ?. region ??
22+ loadConfig ( NODE_REGION_CONFIG_OPTIONS , {
23+ ...NODE_REGION_CONFIG_FILE_OPTIONS ,
24+ profile : config . profile ,
25+ } ) ,
1726 ...config ,
1827 } ;
1928} ;
You can’t perform that action at this time.
0 commit comments