summaryrefslogtreecommitdiff
path: root/src/node_config.cc
diff options
context:
space:
mode:
authorcornholio <0@mcornholio.ru>2017-06-11 22:01:27 +0300
committerRefael Ackermann <refack@gmail.com>2017-06-15 22:50:56 -0400
commit2777a7e04f9a116937296ecd1a7ebd4a32766df6 (patch)
tree1c404a7b39d9d3607b2b3f6f74614b1aa1951a8d /src/node_config.cc
parentf462ad1f35dfb2e8827e383d46ba74058aedfcbc (diff)
downloadnode-new-2777a7e04f9a116937296ecd1a7ebd4a32766df6.tar.gz
inspector,cluster: fix inspect port assignment
* Adding --inspect-port with debug port, instead of parsing `execArgv` * Export CLI debug options to `process.binding('config').debugOptions` (currently used only in tests) PR-URL: https://github.com/nodejs/node/pull/13619 Refs: https://github.com/nodejs/node/pull/9659 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src/node_config.cc')
-rw-r--r--src/node_config.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/node_config.cc b/src/node_config.cc
index f4729a64fe..b309171282 100644
--- a/src/node_config.cc
+++ b/src/node_config.cc
@@ -4,11 +4,14 @@
#include "env-inl.h"
#include "util.h"
#include "util-inl.h"
+#include "node_debug_options.h"
namespace node {
+using v8::Boolean;
using v8::Context;
+using v8::Integer;
using v8::Local;
using v8::Object;
using v8::ReadOnly;
@@ -62,6 +65,27 @@ static void InitConfig(Local<Object> target,
target->DefineOwnProperty(env->context(), name, value).FromJust();
}
+ Local<Object> debugOptions = Object::New(env->isolate());
+
+ target->DefineOwnProperty(env->context(),
+ OneByteString(env->isolate(), "debugOptions"),
+ debugOptions).FromJust();
+
+ debugOptions->DefineOwnProperty(env->context(),
+ OneByteString(env->isolate(), "host"),
+ String::NewFromUtf8(env->isolate(),
+ debug_options.host_name().c_str())).FromJust();
+
+ debugOptions->DefineOwnProperty(env->context(),
+ OneByteString(env->isolate(), "port"),
+ Integer::New(env->isolate(),
+ debug_options.port())).FromJust();
+
+ debugOptions->DefineOwnProperty(env->context(),
+ OneByteString(env->isolate(), "inspectorEnabled"),
+ Boolean::New(env->isolate(),
+ debug_options.inspector_enabled())).FromJust();
+
if (config_expose_internals)
READONLY_BOOLEAN_PROPERTY("exposeInternals");
} // InitConfig