Phoenix - OTP版本导致conn.secret_key_base未设置错误

时间:2016-08-11 19:23:50

标签: phoenix-framework

这肯定是我理解上的差距,所以我希望有人可以帮助澄清。

在phoenix docs中超过here,它说:

# If you are doing OTP releases, you need to instruct Phoenix
# to start the server for all endpoints:
#
    config :phoenix, :serve_endpoints, true

我不太确定,这对一个简单的应用程序有什么影响,但实际上没有设置它似乎也有效。实际上,启用此功能会导致以下错误:

" phoenix cookie store期望设置conn.secret_key_base"

这个设置是什么?为什么需要它?如果没有启用,一切似乎都可以正常工作。

1 个答案:

答案 0 :(得分:0)

菲律宾文档已经过时了。

我可以看到你在编译时遗忘了prod.secret.exs

如果您为了测试目的而构建它,并且不建议将其投入生产,但可以这样设置:

# Configures the endpoint
config :hello_phoenix, HelloPhoenix.Endpoint,
  secret_key_base: "SECRET_KEY"