Skip to content

Commit

Permalink
Merge pull request #1 from eyelevel-care/master
Browse files Browse the repository at this point in the history
syncing changes
  • Loading branch information
maysam authored Oct 8, 2024
2 parents 87f3c2f + e46ad96 commit e1846f6
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/mix/tasks/swagger.generate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ defmodule Mix.Tasks.Phx.Swagger.Generate do
swagger_fun = "swagger_path_#{action}" |> String.to_atom()

loaded? = Code.ensure_compiled(controller)

case loaded? do
{:module, _} ->
%{
Expand All @@ -166,6 +167,7 @@ defmodule Mix.Tasks.Phx.Swagger.Generate do
path: format_path(path),
verb: verb
}

_ ->
Logger.warn("Warning: #{controller} module didn't load.")
nil
Expand Down Expand Up @@ -209,6 +211,7 @@ defmodule Mix.Tasks.Phx.Swagger.Generate do
url = Keyword.get(endpoint_config, :url)
host = Keyword.get(url, :host, "localhost")
port = Keyword.get(url, :port, 4000)
scheme = Keyword.get(url, :scheme, "http")

swagger_map =
if !load_from_system_env and is_binary(host) and (is_integer(port) or is_binary(port)) do
Expand All @@ -218,12 +221,16 @@ defmodule Mix.Tasks.Phx.Swagger.Generate do
swagger_map
end

case endpoint_config[:https] do
nil ->
swagger_map
if scheme == "https" do
Map.put_new(swagger_map, :schemes, ["https", "http"])
else
case endpoint_config[:https] do
nil ->
swagger_map

_ ->
Map.put_new(swagger_map, :schemes, ["https", "http"])
_ ->
Map.put_new(swagger_map, :schemes, ["https", "http"])
end
end
end

Expand Down

0 comments on commit e1846f6

Please sign in to comment.