File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
java/server/src/org/openqa/selenium/grid/config Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 20
20
import com .google .common .collect .ImmutableList ;
21
21
22
22
import java .util .List ;
23
+ import java .util .Locale ;
23
24
import java .util .Objects ;
24
25
import java .util .Optional ;
25
26
27
+ /**
28
+ * Exposes environment variables as config settings by mapping
29
+ * "section.option" to "SECTION_OPTION". Dashes and periods in the options
30
+ * are converted to underscores, and all characters are upper-cased assuming
31
+ * a US English locale.
32
+ */
26
33
public class EnvConfig implements Config {
27
34
28
35
@ Override
29
36
public Optional <List <String >> getAll (String section , String option ) {
30
37
Objects .requireNonNull (section , "Section name not set" );
31
38
Objects .requireNonNull (option , "Option name not set" );
32
39
33
- return Optional .ofNullable (System .getenv ().get (section + "." + option )).map (ImmutableList ::of );
40
+ String key = String .format ("%s_%s" , section , option )
41
+ .toUpperCase (Locale .US )
42
+ .replace ("-" , "_" )
43
+ .replace ("." , "_" );
44
+
45
+ return Optional .ofNullable (System .getenv ().get (key )).map (ImmutableList ::of );
34
46
}
35
47
}
You can’t perform that action at this time.
0 commit comments