Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for hocon format #232

Closed

Conversation

bugthesystem
Copy link

@bugthesystem bugthesystem commented Oct 24, 2017

implements #230

Sample HOCON

# Test HOCON
app {
  name = My App  #comment
}

Sample code

trait ApplicationConfig {
  def name: String
}

val repository = "https://github.com/username/config-repo.git"
val branch: String = "staging"

val provider = new ConfigurationProviderBuilder()
      .withConfigurationSource(
        new GitConfigurationSourceBuilder()
          .withRepositoryURI(repository)
          .withPropertiesProviderSelector(new HoconPropertiesProviderSelector())
          .withConfigFilesProvider(new HoconConfigFilesProvider)
          .build())
      .withEnvironment(new ImmutableEnvironment(branch))
      .withReloadStrategy(new PeriodicalReloadStrategy(5, TimeUnit.SECONDS))
      .build()

val config = provider.bind("app", classOf[ApplicationConfig])

println(s"App name=${config.name}")

@bugthesystem bugthesystem deleted the support-for-hocon-format branch March 8, 2018 15:13
@bugthesystem bugthesystem restored the support-for-hocon-format branch March 8, 2018 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant