Skip to content

Commit 4f73b77

Browse files
committed
chore: add comments
1 parent 3c8a5db commit 4f73b77

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/cmap/auth/mongo_credentials.ts

+26-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,32 @@ export interface AuthMechanismProperties extends Document {
6969
ALLOWED_HOSTS?: string[];
7070
/** The resource token for OIDC auth in Azure and GCP. */
7171
TOKEN_RESOURCE?: string;
72-
/** A custom AWS credential provider to use. */
72+
/**
73+
* A custom AWS credential provider to use. An example using the AWS SDK default provider chain:
74+
*
75+
* ```ts
76+
* const client = new MongoClient(process.env.MONGODB_URI, {
77+
* authMechanismProperties: {
78+
* AWS_CREDENTIAL_PROVIDER: fromNodeProviderChain()
79+
* }
80+
* });
81+
* ```
82+
*
83+
* Using a custom function that returns AWS credentials:
84+
*
85+
* ```ts
86+
* const client = new MongoClient(process.env.MONGODB_URI, {
87+
* authMechanismProperties: {
88+
* AWS_CREDENTIAL_PROVIDER: async () => {
89+
* return {
90+
* accessKeyId: process.env.ACCESS_KEY_ID,
91+
* secretAccessKey: process.env.SECRET_ACCESS_KEY
92+
* }
93+
* }
94+
* }
95+
* });
96+
* ```
97+
*/
7398
AWS_CREDENTIAL_PROVIDER?: AWSCredentialProvider;
7499
}
75100

0 commit comments

Comments
 (0)