如何管理 application.config 文件以最小化播放框架中的代码

How to manage application.config file to minimize code in play framework

例如: 我在 application.config 中编写了如下数据库配置:

    storedb{
     url = "jdbc:mysql://localhost/storedb"
     slick.driver = scala.slick.deiver.MySQLDriver
     user = "user"
     pass = "pass"
    }

我有多个数据库配置,想这样管理它:

    dbUrl= "jdbc:mysql://localhost/"
    dbUser= "user"
    dbPass= "pass"
    slickDriver = scala.slick.deiver.MySQLDriver
    storedb{
     url = dbUrl+"storedb"
     slick.driver = slickDriver
     user = dbUser
     pass = dbPass
    }

如何实现?

AFAIR,你可以这样做

dbUrl= "jdbc:mysql://localhost/"    
dbUser= "user"
dbPass= "pass"
slickDriver = scala.slick.deiver.MySQLDriver

storedb {
 url = "${dbUrl}storedb"
 slick.driver = ${slickDriver}
 user = ${dbUser}
 pass = ${dbPass}
}

查看一些连接示例https://github.com/lightbend/config#concatenation