Skip to content

Commit a0b1de3

Browse files
author
Arthur Cinader
authored
Add a deprecation notice for aws credentials in anticipation of the 2.0 release. (#48)
1 parent 7cedb8e commit a0b1de3

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ parse-server adapter for AWS S3
1010

1111
`npm install --save parse-server-s3-adapter`
1212

13-
# aws credentials
13+
# AWS Credentials
14+
15+
## Deprecation Notice -- AWS Credentials
16+
*the ability to explicitly pass credentials to this adapter is deprecated and will be removed in a future release.*
1417

1518
Although it is not recommended, AWS credentials can be explicitly configured through an options
1619
object, constructor string arguments or environment variables ([see below](#using-a-config-file)).
17-
This option is provided for backward compatibility.
20+
This option is provided for backward compatibility and will be removed in the forthcoming version 2.0 of this adapter.
1821

1922
The preferred method is to use the default AWS credentials pattern. If no AWS credentials are explicitly configured, the AWS SDK will look for credentials in the standard locations used by all AWS SDKs and the AWS CLI. More info can be found in [the docs](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#config-settings-and-precedence). For more information on AWS best practices, see [IAM Best Practices User Guide](http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html).
2023

@@ -32,8 +35,6 @@ The preferred method is to use the default AWS credentials pattern. If no AWS c
3235
"options": {
3336
"bucket": "my_bucket",
3437
// optional:
35-
"accessKey": "accessKey",
36-
"secretKey": "secretKey",
3738
"region": 'us-east-1', // default value
3839
"bucketPrefix": '', // default value
3940
"directAccess": false, // default value
@@ -55,11 +56,9 @@ Set your environment variables:
5556
S3_BUCKET=bucketName
5657
```
5758

58-
the following optional configurations can be set by environment variables too:
59+
the following optional configuration can be set by environment variable too:
5960

6061
```
61-
S3_ACCESS_KEY=accessKey
62-
S3_SECRET_KEY=secretKey
6362
S3_SIGNATURE_VERSION=v4
6463
```
6564

@@ -100,8 +99,8 @@ var api = new ParseServer({
10099
```
101100
S3Adapter("bucket")
102101
S3Adapter("bucket", options)
103-
S3Adapter("key", "secret", "bucket")
104-
S3Adapter("key", "secret", "bucket", options)
102+
S3Adapter("key", "secret", "bucket") -- Deprecated, see notice above
103+
S3Adapter("key", "secret", "bucket", options) -- Deprecated, see notice above
105104
S3Adapter(options) // where options must contain bucket.
106105
S3Adapter(options, s3overrides)
107106
```
@@ -117,8 +116,6 @@ var S3Adapter = require('parse-server-s3-adapter');
117116
var s3Options = {
118117
"bucket": "my_bucket",
119118
// optional:
120-
"accessKey": null, // default value
121-
"secretKey": null, // default value
122119
"region": 'us-east-1', // default value
123120
"bucketPrefix": '', // default value
124121
"directAccess": false, // default value

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
var AWS = require('aws-sdk');
77
var optionsFromArguments = require('./lib/optionsFromArguments');
88

9+
const awsCredentialsDeprecationNotice = function awsCredentialsDeprecationNotice() {
10+
// eslint-disable-next-line no-console
11+
console.warn('Passing AWS credentials to this adapter is now DEPRECATED and will be removed in a future version',
12+
'See: https://github.com/parse-server-modules/parse-server-s3-adapter#aws-credentials for details');
13+
}
14+
915
// Creates an S3 session.
1016
// Providing AWS access, secret keys and bucket are mandatory
1117
// Region will use sane defaults if omitted
@@ -29,6 +35,7 @@ function S3Adapter() {
2935
};
3036

3137
if (options.accessKey && options.secretKey) {
38+
awsCredentialsDeprecationNotice();
3239
s3Options.accessKeyId = options.accessKey;
3340
s3Options.secretAccessKey = options.secretKey;
3441
}

0 commit comments

Comments
 (0)