@middy/ssm 2.4.3 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ This middleware fetches parameters from [AWS Systems Manager Parameter Store](ht
|
|
|
29
29
|
|
|
30
30
|
Parameters to fetch can be defined by path and by name (not mutually exclusive). See AWS docs [here](https://aws.amazon.com/blogs/mt/organize-parameters-by-hierarchy-tags-or-amazon-cloudwatch-events-with-amazon-ec2-systems-manager-parameter-store/).
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Parameters can be assigned to the Node.js `process.env` object by setting the `setToEnv` flag to `true`. They can also be assigned to the function handler's `context` object by setting the `setToContext` flag to `true`. By default all parameters are added with uppercase names.
|
|
33
33
|
|
|
34
34
|
The Middleware makes a single API request to fetch all the parameters defined by name, but must make an additional request per specified path. This is because the AWS SDK currently doesn't expose a method to retrieve parameters from multiple paths.
|
|
35
35
|
|
|
@@ -47,16 +47,16 @@ npm install --save @middy/ssm
|
|
|
47
47
|
|
|
48
48
|
## Options
|
|
49
49
|
|
|
50
|
-
- `AwsClient` (object) (default `AWS.SSM`): AWS.SSM class constructor (e.g. that has been instrumented with AWS
|
|
50
|
+
- `AwsClient` (object) (default `AWS.SSM`): AWS.SSM class constructor (e.g. that has been instrumented with AWS X-Ray). Must be from `aws-sdk` v2.
|
|
51
51
|
- `awsClientOptions` (object) (optional): Options to pass to AWS.SSM class constructor.
|
|
52
52
|
- `awsClientAssumeRole` (string) (optional): Internal key where role tokens are stored. See [@middy/sts](/packages/sts/README.md) on to set this.
|
|
53
|
-
- `awsClientCapture` (function) (optional): Enable
|
|
53
|
+
- `awsClientCapture` (function) (optional): Enable AWS X-Ray by passing `captureAWSClient` from `aws-xray-sdk` in.
|
|
54
54
|
- `fetchData` (object) (required): Mapping of internal key name to API request parameter `Names`/`Path`. `SecureString` are automatically decrypted.
|
|
55
55
|
- `disablePrefetch` (boolean) (default `false`): On cold start requests will trigger early if they can. Setting `awsClientAssumeRole` disables prefetch.
|
|
56
56
|
- `cacheKey` (string) (default `ssm`): Cache key for the fetched data responses. Must be unique across all middleware.
|
|
57
57
|
- `cacheExpiry` (number) (default `-1`): How long fetch data responses should be cached for. `-1`: cache forever, `0`: never cache, `n`: cache for n ms.
|
|
58
58
|
- `setToEnv` (boolean) (default `false`): Store role tokens to `process.env`. **Storing secrets in `process.env` is considered security bad practice**
|
|
59
|
-
- `setToContext` (boolean) (default `false`): Store role
|
|
59
|
+
- `setToContext` (boolean) (default `false`): Store role tokens to `request.context`.
|
|
60
60
|
|
|
61
61
|
NOTES:
|
|
62
62
|
- Lambda is required to have IAM permission for `ssm:GetParameters` and/or `ssm:GetParametersByPath` depending on what you're requesting.
|
|
@@ -79,7 +79,7 @@ handler
|
|
|
79
79
|
.use(ssm({
|
|
80
80
|
fetchData: {
|
|
81
81
|
accessToken: '/dev/service_name/access_token', // single value
|
|
82
|
-
dbParams: '/dev/service_name/database/',
|
|
82
|
+
dbParams: '/dev/service_name/database/', // object of values, key for each path
|
|
83
83
|
defaults: '/dev/defaults'
|
|
84
84
|
},
|
|
85
85
|
setToContext: true
|
|
@@ -109,7 +109,7 @@ handler
|
|
|
109
109
|
.use(ssm({
|
|
110
110
|
fetchData: {
|
|
111
111
|
accessToken: '/dev/service_name/access_token', // single value
|
|
112
|
-
dbParams: '/dev/service_name/database/',
|
|
112
|
+
dbParams: '/dev/service_name/database/', // object of values, key for each path
|
|
113
113
|
},
|
|
114
114
|
cacheExpiry: 15*60*1000,
|
|
115
115
|
cacheKey: 'ssm-secrets'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/ssm",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.3",
|
|
4
4
|
"description": "SSM (EC2 Systems Manager) parameters middleware for the middy framework",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"engines": {
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/middyjs/middy#readme",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@middy/util": "^2.
|
|
49
|
+
"@middy/util": "^2.5.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@middy/core": "^2.
|
|
52
|
+
"@middy/core": "^2.5.3",
|
|
53
53
|
"aws-sdk": "^2.939.0",
|
|
54
54
|
"aws-xray-sdk": "^3.3.3"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "690884d43b9cd632aeca9a5eba1612160b987cd4"
|
|
57
57
|
}
|