[英]Typesafe config secure rendeing
我有以下代码
log(config.render())
但是,如果我在配置中有密码,那么它们将出现在日志中。 有没有简单的方法可以消除这种情况? 我正在寻找这样的东西
log(config.map { if ("password" in it.key.toLowerCase()) "***" else it.value }
.render())
目前唯一明确的解决方案是这样做
val contentHiddenValue = ConfigValueFactory.fromAnyRef("***", "Content hidden")
log.info(config.root()
.withoutKey("security")
.withValue("security", contentHiddenValue)
.render())
明显的缺点是,它仅隐藏确切的配置子树
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.