无法在 spring cloud config server 中禁用解密服务器端 [英] Failed to disable decryption server side in spring cloud config server
问题描述
根据spring cloud config文档,如果我们想禁用服务器端解密并由客户端处理,我们可以在服务器的application.yml中添加以下属性:
According to the spring cloud config documentation, if we want to disable server side decryption and handle it by the client, we can put in server’s application.yml the following property :
spring:
cloud:
config:
server:
encrypt.enabled: false
在服务器端,定义一个环境变量 ENCRYPT_KEY
然后调用一个 curl
以获取加密密码,我更新配置文件然后提交
In server side, a define an env variable ENCRYPT_KEY
then a call a curl
to get encrypted password, I update the configuration file then I commit it
export ENCRYPTED=`curl config-server/encrypt -d ms-password-prod`
echo "spring.data.mongodb.paswword='{cipher}$ENCRYPTED'" >> establishment-services-prod.yml
现在,当我打电话时
curl -v config-server:9090/establishment-services/prod
我希望看到加密的密码,但我解密了密码.
I expect to see encrypted password but I get the password decrypted.
我使用了 spring-boot 1.5.8
和 spring-cloud Dalston.SR4
.
您可以在我的 Github 帐户.
You can find all the code in my Github account.
推荐答案
移动 spring.cloud.config.server.encrypt.enabled
键到 bootstrap
配置文件您的配置服务器应该可以解决这个问题.
Moving the spring.cloud.config.server.encrypt.enabled
key to the bootstrap
configuration file of your config server should fix the issue.
查看项目文档,我不确定这是一种解决方法还是预期的行为,因为似乎只有 encrypt.*
密钥属于引导程序配置.
Looking at the project documentation, I'm not sure if this is a workaround or the intended behavior, as it seems that only the encrypt.*
keys belong in the bootstrap configuration.
这可能是一个错误或文档增强,您可以报告问题跟踪器 spring-cloud-config.
This could be a bug or a documentation enhancement that you could report on the issue tracker spring-cloud-config.
这篇关于无法在 spring cloud config server 中禁用解密服务器端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!