Fix Quartz port not being passed correctly
When CLI options --port/--ws-port were not provided, nil values were being explicitly passed to Server.start_link, which caused Keyword.get to return nil instead of the default. Now we only include port options in the keyword list if they have actual values.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -75,13 +75,16 @@ defmodule OrgGarden.CLI do
|
||||
|
||||
IO.puts("==> Starting development server...")
|
||||
|
||||
case OrgGarden.Server.start_link(
|
||||
notes_dir: notes_dir,
|
||||
output_dir: output_dir,
|
||||
content_dir: content_dir,
|
||||
port: opts[:port],
|
||||
ws_port: opts[:ws_port]
|
||||
) do
|
||||
server_opts =
|
||||
[
|
||||
notes_dir: notes_dir,
|
||||
output_dir: output_dir,
|
||||
content_dir: content_dir
|
||||
]
|
||||
|> maybe_put(:port, opts[:port])
|
||||
|> maybe_put(:ws_port, opts[:ws_port])
|
||||
|
||||
case OrgGarden.Server.start_link(server_opts) do
|
||||
{:ok, pid} ->
|
||||
IO.puts("==> Server running at http://localhost:#{opts[:port] || Config.get(:http_port, 8080)}")
|
||||
IO.puts("==> Watching #{notes_dir} for changes (Ctrl+C to stop)")
|
||||
@@ -379,4 +382,7 @@ defmodule OrgGarden.CLI do
|
||||
IO.puts(:stderr, message)
|
||||
System.halt(1)
|
||||
end
|
||||
|
||||
defp maybe_put(keyword, _key, nil), do: keyword
|
||||
defp maybe_put(keyword, key, value), do: Keyword.put(keyword, key, value)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user