Permalink
Browse files

Fixed #7: Reading "db.${dbName}.password", but not "db.${dbName}.pass"

  • Loading branch information...
1 parent a97d480 commit 89e017ca8d6232f0cf13689112eebf1b1dd5449d @tototoshi committed Feb 9, 2014
@@ -45,6 +45,7 @@ db.secondary.password="secret"
db.third.driver=org.h2.Driver
db.third.url="jdbc:h2:mem:example3;DB_CLOSE_DELAY=-1"
db.third.user="sa"
+db.third.pass="secret3"
# Evolutions
# ~~~~~
@@ -63,4 +64,3 @@ logger.play=INFO
# Logger provided to your application:
logger.application=DEBUG
-
@@ -30,7 +30,7 @@ class ConfigReaderSpec extends FunSpec with ShouldMatchers {
val configMap = reader.getDatabaseConfigurations
configMap.get("default") should be(Some(DatabaseConfiguration("org.h2.Driver", "jdbc:h2:mem:example;DB_CLOSE_DELAY=-1", "sa", null)))
configMap.get("secondary") should be(Some(DatabaseConfiguration("org.h2.Driver", "jdbc:h2:mem:example2;db_CLOSE_DELAY=-1", "sa", "secret")))
- configMap.get("third") should be(Some(DatabaseConfiguration("org.h2.Driver", "jdbc:h2:mem:example3;DB_CLOSE_DELAY=-1", "sa", null)))
+ configMap.get("third") should be(Some(DatabaseConfiguration("org.h2.Driver", "jdbc:h2:mem:example3;DB_CLOSE_DELAY=-1", "sa", "secret3")))
}
}
@@ -36,11 +36,12 @@ class ConfigReader(app: Application) {
throw new MigrationConfigurationException(s"db.${dbName}.driver is not set.")
)
val user = app.configuration.getString(s"db.${dbName}.user").orNull
- val password = app.configuration.getString(s"db.${dbName}.password").orNull
+ val password = app.configuration.getString(s"db.${dbName}.password")
+ .orElse(app.configuration.getString(s"db.${dbName}.pass"))
+ .orNull
dbName -> DatabaseConfiguration(driver, url, user, password)
}).toMap
}
}
-

0 comments on commit 89e017c

Please sign in to comment.