MCPcopy
hub / github.com/OpenTSDB/opentsdb / getConfig

Method getConfig

src/tools/CliOptions.java:94–109  ·  view source on GitHub ↗

Attempts to load a configuration given a file or default files and overrides with command line arguments @return A config object with user settings or defaults @throws IOException If there was an error opening any of the config files @throws FileNotFoundException If the user provided config file was

(final ArgP argp)

Source from the content-addressed store, hash-verified

92 * @since 2.0
93 */
94 static final Config getConfig(final ArgP argp) throws IOException {
95 // load configuration
96 final Config config;
97 final String config_file = argp.get("--config", "");
98 if (!config_file.isEmpty())
99 config = new Config(config_file);
100 else
101 config = new Config(true);
102
103 // load CLI overloads
104 overloadConfig(argp, config);
105 // the auto metric is recorded to a class boolean flag since it's used so
106 // often. We have to set it manually after overriding.
107 config.setAutoMetric(config.getBoolean("tsd.core.auto_create_metrics"));
108 return config;
109 }
110
111 /**
112 * Copies the parsed command line options to the {@link Config} class

Callers 7

mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95
mainMethod · 0.95

Calls 5

overloadConfigMethod · 0.95
setAutoMetricMethod · 0.95
getBooleanMethod · 0.95
isEmptyMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected