paulwong

SPRING 中YAML文件密码不以明文保存

Update: for production environment, to avoid exposing the password in the command line, since you can query the processes with ps, previous commands with history, etc etc. You could:

  • Create a script like this: touch setEnv.sh
  • Edit setEnv.sh to export the JASYPT_ENCRYPTOR_PASSWORD variable

    #!/bin/bash

    export JASYPT_ENCRYPTOR_PASSWORD=supersecretz

  • Execute the file with . setEnv.sh
  • Run the app in background with mvn spring-boot:run &
  • Delete the file setEnv.sh
  • Unset the previous environment variable with: unset JASYPT_ENCRYPTOR_PASSWORD

https://stackoverflow.com/questions/37404703/spring-boot-how-to-hide-passwords-in-properties-file

posted on 2020-10-20 14:59 paulwong 阅读(452) 评论(0)  编辑  收藏 所属分类: JASYPT


只有注册用户登录后才能发表评论。


网站导航: