Typesafe Config允许创建条件配置吗?
我需要根据另一个键的值设置一个键:
ssl = true
#if ssl == true
host = "https://localhost"
#else
host = "http://localhost"
#end if
当然,上面的代码不起作用...我只是想说明我正在尝试做什么。
Typesafe Config允许创建条件配置吗?
我需要根据另一个键的值设置一个键:
ssl = true
#if ssl == true
host = "https://localhost"
#else
host = "http://localhost"
#end if
当然,上面的代码不起作用...我只是想说明我正在尝试做什么。
没有直接的方法。对于你提供的特定示例,你可以使用可选属性:
protocol = "http"
protocol = ${?MY_PROTOCOL}
host = ${protocol}://localhost