Skip to content

Commit bcb31f8

Browse files
committed
fixup! src: support namespace options in configuration file
1 parent 9a4d387 commit bcb31f8

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

lib/internal/options.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function generateConfigJsonSchema() {
4242
const envOptionsMap = getEnvOptionsInputType();
4343
const namespaceOptionsMap = getNamespaceOptionsInputType();
4444

45-
function createPropertyForType(key, type) {
45+
function createPropertyForType(type) {
4646
if (type === 'array') {
4747
return {
4848
__proto__: null,
@@ -83,7 +83,7 @@ function generateConfigJsonSchema() {
8383
// Add env options to nodeOptions (backward compatibility)
8484
for (const { 0: key, 1: type } of envOptionsMap) {
8585
const keyWithoutPrefix = StringPrototypeReplace(key, '--', '');
86-
nodeOptions[keyWithoutPrefix] = createPropertyForType(key, type);
86+
nodeOptions[keyWithoutPrefix] = createPropertyForType(type);
8787
}
8888

8989
// Add namespace properties at the root level
@@ -101,7 +101,7 @@ function generateConfigJsonSchema() {
101101
// Add all options for this namespace
102102
for (const { 0: optionName, 1: optionType } of optionsMap) {
103103
const keyWithoutPrefix = StringPrototypeReplace(optionName, '--', '');
104-
namespaceProperties[keyWithoutPrefix] = createPropertyForType(optionName, optionType);
104+
namespaceProperties[keyWithoutPrefix] = createPropertyForType(optionType);
105105
}
106106

107107
// Sort the namespace properties alphabetically

src/node_config_file.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ ParseResult ConfigReader::ParseConfig(const std::string_view& config_path) {
261261

262262
// Check if this field is a valid namespace
263263
std::string namespace_name(field_name);
264-
if (valid_namespaces.find(namespace_name) == valid_namespaces.end()) {
264+
if (!valid_namespaces.contains(namespace_name)) {
265265
// If not, skip it
266266
continue;
267267
}
@@ -294,13 +294,13 @@ std::string ConfigReader::GetNodeOptions() {
294294
std::string acc = "";
295295
const size_t total_options = node_options_.size();
296296
acc.reserve(total_options * 2);
297-
for (size_t i = 0; i < node_options_.size(); ++i) {
298-
acc += " " + node_options_[i];
297+
for (auto& opt : node_options_) {
298+
acc += " " + opt;
299299
}
300300
return acc;
301301
}
302302

303-
std::vector<std::string> ConfigReader::GetNamespaceFlags() {
303+
const std::vector<std::string>& ConfigReader::GetNamespaceFlags() const {
304304
return namespace_options_;
305305
}
306306

src/node_config_file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ConfigReader {
3333
const std::vector<std::string>& args);
3434

3535
std::string GetNodeOptions();
36-
std::vector<std::string> GetNamespaceFlags();
36+
const std::vector<std::string>& GetNamespaceFlags() const;
3737

3838
size_t GetFlagsSize();
3939

0 commit comments

Comments
 (0)