我有application.conf
{
name {
postgres {
host = ""
username = ""
password = ""
}
}
}
我想添加我的local.conf
{
name {
postgres {
host = "blabla"
username = "aa"
password = "bb"
}
}
}
name.postgres.host.override =“” -不起作用
答案 0 :(得分:1)
在您的application.conf
中,它将保持不变:
{
name {
postgres {
host = ""
username = ""
password = ""
}
}
}
在local.conf
中,您应该这样添加application.conf
:
include "application.conf"
{
name {
postgres {
host = "blabla"
username = "aa"
password = "bb"
}
}
}
运行sbt时,您应该特别提到要像这样加载local.conf
(否则application.conf
将默认加载):
sbt run -Dconfig.resource=local.conf
这样,local.conf
将从application.conf
扩展。如果两个文件中都存在任何密钥,则将选择local.conf
中的值。
现在,您将得到:
name.postgres.host=blabla
答案 1 :(得分:0)