gpt4 book ai didi

java - 配置错误[未设置应用程序 secret ]

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:08:33 26 4
gpt4 key购买 nike

我在生产模式下运行 Play 2.4 服务器时遇到此错误:

play.api.UnexpectedException: Unexpected exception[ProvisionException: Unable to provision, see the following errors:

1) Error in custom provider, @6mh5cjo5l: Configuration error
while locating play.api.libs.CryptoConfigParser
while locating play.api.libs.CryptoConfig

...

Caused by: play.api.PlayException: Configuration error[Application secret not set]

如何修复?

最佳答案

默认的 Play 模板使用以下内容:

play.crypto.secret="changeme"

application.conf 中需要更改以用于生产。 Play 提供了一个实用程序来为您生成随机 secret :

./activator playGenerateSecret

然后您可以将其填充为环境变量:

APPLICATION_SECRET=...

并在 conf/application.conf 中确保以下内容:

play.crypto.secret="changeme"
play.crypto.secret=${?APPLICATION_SECRET}

作为Play documentation解释:

The second line in that configuration sets the secret to come from an environment variable called APPLICATION_SECRET if such an environment variable is set, otherwise, it leaves the secret unchanged from the previous line.

然后错误就会消失。

关于java - 配置错误[未设置应用程序 secret ],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30981261/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com