Specify ip for iframe endpoint only when present (#1176)

* Specify ip for iframe endpoint only when present

* Up
This commit is contained in:
Jonatan Kłosko 2022-05-06 22:11:19 +02:00 committed by GitHub
parent c1a4c8c045
commit 9f24bda2c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -197,12 +197,14 @@ defmodule Livebook.Application do
port = Livebook.Config.iframe_port()
if server? do
iframe_opts = [
scheme: :http,
plug: LivebookWeb.IframeEndpoint,
options: [port: port],
ip: Application.fetch_env!(:livebook, LivebookWeb.Endpoint)[:http][:ip]
]
http = Application.fetch_env!(:livebook, LivebookWeb.Endpoint)[:http]
iframe_opts =
[
scheme: :http,
plug: LivebookWeb.IframeEndpoint,
port: port
] ++ Keyword.take(http, [:ip])
spec = Plug.Cowboy.child_spec(iframe_opts)
spec = update_in(spec.start, &{__MODULE__, :start_iframe, [port, &1]})