Skip to content

Commit

Permalink
refactor word count job config
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Kuthan committed Apr 12, 2015
1 parent dbbe5b9 commit 365eff6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/scala/example/WordCountJob.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,14 @@ object WordCountJobConfig {
import net.ceedubs.ficus.Ficus._
import net.ceedubs.ficus.readers.ArbitraryTypeReader.arbitraryTypeValueReader

def apply(): WordCountJobConfig = apply(ConfigFactory.load())
def apply(applicationConfig: Option[Config] = None): WordCountJobConfig = {

def apply(applicationConfig: Config): WordCountJobConfig = {
val rootConfig = applicationConfig match {
case Some(c) => c.withFallback(ConfigFactory.load)
case _ => ConfigFactory.load
}

val config = applicationConfig.getConfig("wordCountJob")
val config = rootConfig.getConfig("wordCountJob")

new WordCountJobConfig(
config.as[String]("input.topic"),
Expand Down

0 comments on commit 365eff6

Please sign in to comment.