From 96f3977ded6c628c75171ffb2595ca0f1a8b0d29 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 12 Jan 2021 15:38:00 -0800 Subject: [PATCH] process: runtime deprecate changing process.config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fact that `process.config` is mutable has long made it unreliable when it really should just work. Start the process of deprecating the ability to change it. Fixes: https://github.com/nodejs/node/issues/7803 Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/36902 Reviewed-By: Joyee Cheung Reviewed-By: Michaƫl Zasso --- doc/api/deprecations.md | 15 +++++++ doc/api/process.md | 8 ++++ lib/internal/bootstrap/node.js | 72 +++++++++++++++++++++++++++++++++- 3 files changed, 94 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 86b25b3613..ca1a0c6ba4 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2711,6 +2711,21 @@ Type: Documentation-only. Prefer [`message.socket`][] over [`message.connection`][]. +### DEP0XXX: Changing the value of `process.config` + + +Type: Runtime + +The `process.config` property is intended to provide access to configuration +settings set when the Node.js binary was compiled. However, the property has +been mutable by user code making it impossible to rely on. The ability to +change the value has been deprecated and will be disabled in the future. + [Legacy URL API]: url.md#url_legacy_url_api [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf [RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3 diff --git a/doc/api/process.md b/doc/api/process.md index cfd1866f3d..773686354e 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -759,6 +759,10 @@ This feature is not available in [`Worker`][] threads. ## `process.config` * {Object} @@ -803,6 +807,10 @@ The `process.config` property is **not** read-only and there are existing modules in the ecosystem that are known to extend, modify, or entirely replace the value of `process.config`. +Modifying the `process.config` property, or any child-property of the +`process.config` object has been deprecated. The `process.config` will be made +read-only in a future release. + ## `process.connected`