diff --git a/.gitignore b/.gitignore index 755b605..b9b1455 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /deps erl_crash.dump *.ez +.idea/ +*.iml diff --git a/lib/mix/tasks/swagger.generate.ex b/lib/mix/tasks/swagger.generate.ex index c64bdcb..00ce76e 100644 --- a/lib/mix/tasks/swagger.generate.ex +++ b/lib/mix/tasks/swagger.generate.ex @@ -180,6 +180,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 @@ -188,6 +189,13 @@ defmodule Mix.Tasks.Phx.Swagger.Generate do swagger_map # host / port may be {:system, "ENV_VAR"} tuples or loaded in Endpoint.init callback end + swagger_map = + if scheme == "https" do + Map.put_new(swagger_map, :schemes, ["https", "http"]) + else + swagger_map + end + case endpoint_config[:https] do nil -> swagger_map