Skip to content

Commit

Permalink
chore: add env var for suppressing maintenance mode message (#4357)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe authored Mar 13, 2023
1 parent d8503e0 commit f229a12
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "maintenance mode message",
"description": "add environment var for suppression of maintenance mode message"
}
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
login:
ada credentials update --account 812168580665 --role Admin --once

sync:
gh repo sync kuhe/aws-sdk-js -b master
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ for updates and announcements regarding the maintenance plans and timelines.
Please refer to the [AWS SDKs and Tools maintenance policy][aws-sdks-maintenance-policy]
for further details.

A maintenance mode message may be emitted by this package on startup.
To suppress this message, use an environment variable:

```sh
AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE=1 node my_program.js
```

or a JavaScript setting as follows:
```js
var SDK = require('aws-sdk');
require('aws-sdk/lib/maintenance_mode_message').suppress = true;
```

[v2-new-issue]: https://github.com/aws/aws-sdk-js/issues/new/choose
[v3-recommended-blog]: https://aws.amazon.com/blogs/developer/why-and-how-you-should-use-aws-sdk-for-javascript-v3-on-node-js-18/
[v3-contributing]: https://github.com/aws/aws-sdk-js-v3#giving-feedback-and-contributing
Expand Down
7 changes: 7 additions & 0 deletions lib/maintenance_mode_message.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ function emitWarning() {
return;
}

if (
typeof process.env === 'object' &&
typeof process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE !== 'undefined'
) {
return;
}

if (typeof process.emitWarning === 'function') {
process.emitWarning(warning, {
type: 'NOTE'
Expand Down

0 comments on commit f229a12

Please sign in to comment.