`-D` command-line arguments for node properties are overridden by `node.properties` · Issue #11 · airlift/launcher · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In the current Go implementation of the launcher, system properties provided via the -D command-line argument (e.g., -Dnode.id=foo) are overridden by values defined in the node.properties file if the same key exists in both. This is a regression from the previous Python-based launcher, where command-line arguments had higher precedence and could override settings from the node.properties file.
Steps to reproduce
Create or modify etc/node.properties to include a property, for example:
node.id=id_from_file
Run the launcher with a -D argument for the same property but a different value:
./launcher -Dnode.id=id_from_cli run
Observe the effective node.id used by the application.
Expected behavior
The node.id used by the application should be id_from_cli, as the command-line argument should override the value from the node.properties file.
Actual behavior
The node.id used by the application is id_from_file, because the values from node.properties are applied after the command-line -D arguments are parsed, effectively overwriting them.
Code reference
The issue likely stems from the order of operations in src/main/go/args/args.go. The system properties from -D flags are parsed first, and then properties from node.properties are copied into the system properties, potentially overwriting the command-line specified values.
Specifically, this block of code:
// src/main/go/args/args.go lines 223-230options.SystemProperties, err=properties.Parse(flags.systemPropertiesOpt)
iferr!=nil {
returncommands.UNKNOWN, nil, fmt.Errorf("provided system properties are invalid: %w", err)
}
// Copy node.config properties into system propertiesforkey, value:=rangeoptions.NodeConfig {
options.SystemProperties[key] =value
}
This logic means that options.NodeConfig (from node.properties) will overwrite any identically named keys already present in options.SystemProperties (from -D flags).
To fix this, the -D arguments should be applied after the node.properties are loaded, or the copying logic should check if a key already exists from a -D argument and not overwrite it.
The text was updated successfully, but these errors were encountered:
Describe the bug
In the current Go implementation of the launcher, system properties provided via the
-D
command-line argument (e.g.,-Dnode.id=foo
) are overridden by values defined in thenode.properties
file if the same key exists in both. This is a regression from the previous Python-based launcher, where command-line arguments had higher precedence and could override settings from thenode.properties
file.Steps to reproduce
etc/node.properties
to include a property, for example:node.id=id_from_file
-D
argument for the same property but a different value:node.id
used by the application.Expected behavior
The
node.id
used by the application should beid_from_cli
, as the command-line argument should override the value from thenode.properties
file.Actual behavior
The
node.id
used by the application isid_from_file
, because the values fromnode.properties
are applied after the command-line-D
arguments are parsed, effectively overwriting them.Code reference
The issue likely stems from the order of operations in
src/main/go/args/args.go
. The system properties from-D
flags are parsed first, and then properties fromnode.properties
are copied into the system properties, potentially overwriting the command-line specified values.Specifically, this block of code:
This logic means that
options.NodeConfig
(fromnode.properties
) will overwrite any identically named keys already present inoptions.SystemProperties
(from-D
flags).To fix this, the
-D
arguments should be applied after thenode.properties
are loaded, or the copying logic should check if a key already exists from a-D
argument and not overwrite it.The text was updated successfully, but these errors were encountered: