package com.softwaremill.codebrag.service.config

import com.typesafe.config.Config

trait RepositoryConfig extends ConfigWithDefault {

  def rootConfig: Config

  // directory containing cloned repo dir
  val repositoriesRoot = getString("repository.repos-root", "repos")

  // for user/pass
  val username = getOptional("repository.username")
  val password = getOptional("repository.password")

  // for SSH
  val passphrase = getOptional("repository.passphrase")

  private def getOptional(fullPath: String, default: Option[String] = None) = {
    if(rootConfig.hasPath(fullPath)) {
      Some(rootConfig.getString(fullPath))
    } else {
      default
    }
  }

}
package com.softwaremill.codebrag.service.config

import com.typesafe.config.Config

trait RepositoryConfig extends ConfigWithDefault {

  def rootConfig: Config

  // directory containing cloned repo dir
  val repositoriesRoot = getString("repository.repos-root", ".")

  // for user/pass
  val username = getOptional("username")
  val password = getOptional("password")

  // for SSH
  val passphrase = getOptional("passphrase")

  private def getOptional(path: String, default: Option[String] = None) = {
    val repositoryConfigSection = rootConfig.getConfig("repository")
    if(repositoryConfigSection.hasPath(path)) {
      Some(repositoryConfigSection.getString(path))
    } else {
      default
    }
  }
}
--- 
+++ 
@@ -7,21 +7,21 @@
   def rootConfig: Config
 
   // directory containing cloned repo dir
-  val repositoriesRoot = getString("repository.repos-root", ".")
+  val repositoriesRoot = getString("repository.repos-root", "repos")
 
   // for user/pass
-  val username = getOptional("username")
-  val password = getOptional("password")
+  val username = getOptional("repository.username")
+  val password = getOptional("repository.password")
 
   // for SSH
-  val passphrase = getOptional("passphrase")
+  val passphrase = getOptional("repository.passphrase")
 
-  private def getOptional(path: String, default: Option[String] = None) = {
-    val repositoryConfigSection = rootConfig.getConfig("repository")
-    if(repositoryConfigSection.hasPath(path)) {
-      Some(repositoryConfigSection.getString(path))
+  private def getOptional(fullPath: String, default: Option[String] = None) = {
+    if(rootConfig.hasPath(fullPath)) {
+      Some(rootConfig.getString(fullPath))
     } else {
       default
     }
   }
+
 }
Make repository configuration work fine when there is no section in config file (take defaults)
