如何在Phoenix Framework中通过env添加路由器配置

时间:2018-04-11 04:33:55

标签: phoenix-framework distillery

我正在为twitter开发一个电报机器人,源代码是在github https://github.com/chenxsan/telegram-bot-for-twitter上开源的。但我想通过隐藏它来保护webhook,所以我正在从config中读取webhook:

scope "/api", TweetBotWeb do
    pipe_through :api
    post "/#{Application.get_env(:tweet_bot, :webhook)}", TwitterController, :index
  end

prod.secret.exs

config :tweet_bot, webhook: "${WEBHOOK}"

但是在使用https://github.com/bitwalker/distillery/构建后,该版本将无法从env中读取WEBHOOK,因此我发现了404错误。

是否可以在PhoenixFramework中执行此操作?如果是的话,我该怎么做呢?

0 个答案:

没有答案
相关问题