Skip to content

Commit 2a1670b

Browse files
authored
chore: improve config by making properties private and fix type issues (#6615)
This improves the type situation a lot in the file and makes it clearer what things belong to. It also simplifies the code a bit.
1 parent 58f72a0 commit 2a1670b

File tree

7 files changed

+474
-489
lines changed

7 files changed

+474
-489
lines changed

packages/datadog-core/src/utils/src/set.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ module.exports = function set (object, path, value) {
55
while (true) {
66
const nextIndex = path.indexOf('.', index + 1)
77
if (nextIndex === -1) {
8-
object[path.slice(index + 1)] = value
8+
if (index === -1) {
9+
object[path] = value
10+
} else {
11+
object[path.slice(index + 1)] = value
12+
}
913
return
1014
}
1115
object = object[path.slice(index + 1, nextIndex)] ??= {}

packages/dd-trace/src/config-helper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ for (const deprecation of Object.keys(deprecations)) {
3737
module.exports = {
3838
/**
3939
* Returns the environment variables that are supported by the tracer
40-
* (including all non-Datadog/OTEL specific environment variables)
40+
* (including all non-Datadog/OTEL specific environment variables).
41+
*
42+
* This should only be called once in config.js to avoid copying the object frequently.
4143
*
4244
* @returns {TracerEnv} The environment variables
4345
*/

0 commit comments

Comments
 (0)