Pet*_*r R 2 elixir phoenix-framework edeliver
我正在使用edeliver在aws上部署.部署运行正常,但是当我尝试在控制台中访问该站点时curl localhost:8888,我收到connection refused错误.
如果我尝试启动应用程序./rel/bin/app_name console,我会得到一个(RuntimeError) expected the PORT environment variable to be set.但是我config/prod.exs看起来像这样.
use Mix.Config
config :elixir_deploy, ElixirDeployWeb.Endpoint,
load_from_system_env: true,
http: [port: 8888],
ssl: false,
url: [host: "example.com", port: 80],
cache_static_manifest: "priv/static/cache_manifest.json"
config :logger, level: :info
import_config "prod.secret.exs"
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么?如果我PORT=8888在手动启动之前设置了它,它可以工作,但我宁愿自动启动edeliver
您需要设置load_from_system_env到false(或只是删除了这一行).如果是这样true,Phoenix生成的默认值endpoint.ex将使用PORT环境变量的值,如果找不到,则会引发错误.
if config[:load_from_system_env] do
port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
{:ok, Keyword.put(config, :http, [:inet6, port: port])}
else
{:ok, config}
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
678 次 |
| 最近记录: |