/** * Returns a CliConfig instance with values parsed from the specified file. * * <p>If the file is not found, a CliConfig with pre-defined values will be returned. * * @param defaultsFile The file to parse from * * @return The configuration * * @throws IOException If the file exists but could not be read * @throws URISyntaxException If a HELIOS_MASTER env var is present and doesn't parse as a URI */ public static CliConfig fromFile(final File defaultsFile, final Map<String, String> environmentVariables) throws IOException, URISyntaxException { final Config config; if (defaultsFile.exists() && defaultsFile.canRead()) { config = ConfigFactory.parseFile(defaultsFile); } else { config = ConfigFactory.empty(); } return fromEnvVar(config, environmentVariables); }
/** * Returns a CliConfig instance with values parsed from the specified file. * * If the file is not found, a CliConfig with pre-defined values will be returned. * * @param defaultsFile The file to parse from * @return The configuration * @throws IOException If the file exists but could not be read * @throws URISyntaxException If a HELIOS_MASTER env var is present and doesn't parse as a URI */ public static CliConfig fromFile(final File defaultsFile) throws IOException, URISyntaxException { final Config config; if (defaultsFile.exists() && defaultsFile.canRead()) { config = ConfigFactory.parseFile(defaultsFile); } else { config = ConfigFactory.empty(); } return fromEnvVar(config); }