com.typesafe.config.ConfigResolveOptions Java Examples

The following examples show how to use com.typesafe.config.ConfigResolveOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UHC.java    From UHC with MIT License 6 votes vote down vote up
protected Config setupMessagesConfig() throws IOException {
    // copy reference across
    saveResource("messages.reference.conf", true);

    // parse fallback config
    final File reference = new File(getDataFolder(), "messages.reference.conf");
    final Config fallback = ConfigFactory.parseFile(reference);

    // parse user provided config
    final File regular = new File(getDataFolder(), "messages.conf");

    final Config user;
    if (regular.exists()) {
        user = ConfigFactory.parseFile(regular);
    } else {
        user = ConfigFactory.empty();
    }

    return user.withFallback(fallback).resolve(ConfigResolveOptions.noSystem());
}
 
Example #2
Source File: TestConfigFactory.java    From xio with Apache License 2.0 5 votes vote down vote up
public static Config load(Config overrides) {
  Config defaultOverrides = ConfigFactory.defaultOverrides();
  Config application = ConfigFactory.defaultApplication();
  Config reference = ConfigFactory.defaultReference();
  ConfigResolveOptions resolveOptions = ConfigResolveOptions.defaults();
  return overrides
      .withFallback(defaultOverrides)
      .withFallback(application)
      .withFallback(reference)
      .resolve(resolveOptions);
}
 
Example #3
Source File: HeliosConfig.java    From helios with Apache License 2.0 5 votes vote down vote up
/**
 * Return the root configuration loaded from the helios configuration files.
 */
static Config loadConfig() {
  final ConfigResolveOptions resolveOptions = ConfigResolveOptions
      .defaults()
      .setAllowUnresolved(true);

  final ConfigParseOptions parseOptions = ConfigParseOptions.defaults();

  final Config baseConfig = ConfigFactory.load(BASE_CONFIG_FILE, parseOptions, resolveOptions);

  final Config appConfig = ConfigFactory.load(APP_CONFIG_FILE, parseOptions, resolveOptions);

  return appConfig.withFallback(baseConfig);
}
 
Example #4
Source File: ConfigurationImpl.java    From wisdom with Apache License 2.0 5 votes vote down vote up
/**
 * @return All properties that are currently loaded from internal and
 * external files
 */
@Override
public Map<String, Object> asMap() {
    return configuration
            .resolve(ConfigResolveOptions.defaults().setUseSystemEnvironment(true).setAllowUnresolved(true))
            .root()
            .unwrapped();
}
 
Example #5
Source File: NestedConfig.java    From Bats with Apache License 2.0 4 votes vote down vote up
@Override
public Config resolve(ConfigResolveOptions options) {
  return c.resolve(options);
}
 
Example #6
Source File: DittoServiceConfig.java    From ditto with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Config resolve(final ConfigResolveOptions options) {
    return serviceScopedConfig.resolve(options);
}
 
Example #7
Source File: DittoServiceConfig.java    From ditto with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Config resolveWith(final Config source, final ConfigResolveOptions options) {
    return serviceScopedConfig.resolveWith(source, options);
}
 
Example #8
Source File: DefaultScopedConfig.java    From ditto with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Config resolve(final ConfigResolveOptions options) {
    return config.resolve(options);
}
 
Example #9
Source File: DefaultScopedConfig.java    From ditto with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Config resolveWith(final Config source, final ConfigResolveOptions options) {
    return config.resolveWith(source, options);
}
 
Example #10
Source File: ConfigWithFallback.java    From ditto with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Config resolve(final ConfigResolveOptions options) {
    return baseConfig.resolve(options);
}
 
Example #11
Source File: ConfigWithFallback.java    From ditto with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Config resolveWith(final Config source, final ConfigResolveOptions options) {
    return baseConfig.resolveWith(source, options);
}
 
Example #12
Source File: NestedConfig.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Config resolve(ConfigResolveOptions options) {
  return config.resolve(options);
}
 
Example #13
Source File: NestedConfig.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Config resolveWith(Config arg0, ConfigResolveOptions arg1) {
  return config.resolveWith(arg0, arg1);
}
 
Example #14
Source File: KanelaConfiguration.java    From kanela with Apache License 2.0 4 votes vote down vote up
private static Config loadDefaultConfig(ClassLoader classLoader) {
    return ConfigFactory
            .load(classLoader, ConfigParseOptions.defaults(), ConfigResolveOptions.defaults()
            .setAllowUnresolved(true));
}
 
Example #15
Source File: HOCONInputStreamFlowTemplate.java    From incubator-gobblin with Apache License 2.0 4 votes vote down vote up
public HOCONInputStreamFlowTemplate(InputStream inputStream, URI flowTemplateDirUri, FlowCatalogWithTemplates catalog)
    throws SpecNotFoundException, IOException, JobTemplate.TemplateException, URISyntaxException {
  this(ConfigFactory.parseReader(new InputStreamReader(inputStream, Charsets.UTF_8)).resolve(
      ConfigResolveOptions.defaults().setAllowUnresolved(true)), flowTemplateDirUri, catalog);
}