2016-07-04 109 views
0

我有以下代码类型安全配置安全rendeing

log(config.render()) 

但是如果我有密码在config那么他们就会出现在日志中。有没有容易方式来消除这个?我要寻找类似的东西

log(config.map { if ("password" in it.key.toLowerCase()) "***" else it.value } 
    .render()) 

回答

0

现在唯一清楚的解决办法是做这样的

val contentHiddenValue = ConfigValueFactory.fromAnyRef("***", "Content hidden") 
log.info(config.root() 
     .withoutKey("security") 
     .withValue("security", contentHiddenValue) 
     .render()) 

明显的缺点是,它隐藏仅供参考,配置子树