Skip to content

Commit

Permalink
fix an application env with ConfigureUploads
Browse files Browse the repository at this point in the history
  • Loading branch information
joshk authored and jjcarstens committed Dec 27, 2023
1 parent 599d3bb commit 3959172
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/nerves_hub_web/plugs/configure_uploads.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ defmodule NervesHubWeb.Plugs.ConfigureUploads do
def init(_opts), do: []

def call(conn, _opts) do
if System.get_env("FIRMWARE_UPLOAD_BACKEND") == "local" do
if local_uploads?() do
conn
|> NervesHubWeb.Plugs.FileUpload.call([])
|> NervesHubWeb.Plugs.StaticUploads.call([])
else
conn
end
end

defp local_uploads?() do
Application.get_env(:nerves_hub, :firmware_upload) == NervesHub.Firmwares.Upload.File
end
end

0 comments on commit 3959172

Please sign in to comment.