Skip to content

Commit 2368f7a

Browse files
committed
[grid] Avoiding primitives for boolean configs
This overrides values configured in files. Also, reverting change where files has more precedence over flags. Avoiding primitives is enough for this.
1 parent d735674 commit 2368f7a

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

java/server/src/org/openqa/selenium/grid/TemplateGridCommand.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ public final Executable configure(PrintStream out, PrintStream err, String... ar
7676
}
7777

7878
// Order matters here. The configs precedence is: 1. Env vars, 2. System properties,
79-
// 3. Configuration files (config.toml), 4. Cli flags and default values
79+
// 3. Cli flags and default values, 4. Configuration files (config.toml)
8080
// 5. Default role config
8181
Set<Config> allConfigs = new LinkedHashSet<>();
8282
allConfigs.add(new EnvConfig());
8383
allConfigs.add(new ConcatenatingConfig(getSystemPropertiesConfigPrefix(), '.', System.getProperties()));
84-
allConfigs.add(configFlags.readConfigFiles());
8584
allFlags.forEach(flags -> allConfigs.add(new AnnotatedConfig(flags)));
85+
allConfigs.add(configFlags.readConfigFiles());
8686
allConfigs.add(getDefaultConfig());
8787

8888
Config config = new MemoizedConfig(new CompoundConfig(allConfigs.toArray(new Config[0])));

java/server/src/org/openqa/selenium/grid/node/config/NodeOptions.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private SessionFactory createSessionFactory(String clazz, Capabilities stereotyp
148148
private void addDetectedDrivers(
149149
Map<WebDriverInfo, Collection<SessionFactory>> allDrivers,
150150
ImmutableMultimap.Builder<Capabilities, SessionFactory> sessionFactories) {
151-
if (!config.getBool(NODE_SECTION, "detect-drivers").orElse(false)) {
151+
if (!config.getBool(NODE_SECTION, "detect-drivers").orElse(true)) {
152152
return;
153153
}
154154

@@ -175,7 +175,7 @@ private Map<WebDriverInfo, Collection<SessionFactory>> discoverDrivers(
175175
int maxSessions,
176176
Function<WebDriverInfo, Collection<SessionFactory>> factoryFactory) {
177177

178-
if (!config.getBool(NODE_SECTION, "detect-drivers").orElse(false)) {
178+
if (!config.getBool(NODE_SECTION, "detect-drivers").orElse(true)) {
179179
return ImmutableMap.of();
180180
}
181181

java/server/src/org/openqa/selenium/grid/node/httpd/NodeFlags.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ public class NodeFlags implements HasRoles {
4242

4343
@Parameter(
4444
names = {"--detect-drivers"}, arity = 1,
45-
description = "Autodetect which drivers are available on the current system, and add them to the node.")
45+
description = "Autodetect which drivers are available on the current system, " +
46+
"and add them to the node. Defaults to true.")
4647
@ConfigValue(section = "node", name = "detect-drivers", example = "true")
47-
public Boolean autoconfigure = true;
48+
public Boolean autoconfigure;
4849

4950
@Parameter(
5051
names = {"-I", "--driver-implementation"},

java/server/src/org/openqa/selenium/grid/router/httpd/RouterFlags.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class RouterFlags implements HasRoles {
3737
" in contravention of strict W3C spec compliance.",
3838
arity = 1)
3939
@ConfigValue(section = "network", name = "relax-checks", example = "true")
40-
private boolean relaxChecks;
40+
private Boolean relaxChecks;
4141

4242
@Override
4343
public Set<Role> getRoles() {

0 commit comments

Comments
 (0)