Skip to content

Commit

Permalink
fix video path being incorrect in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
breunigs committed Jan 12, 2025
1 parent e05367c commit 1bd3871
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 2 additions & 3 deletions config/settings.exs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ config :veloroute, Settings, %{

# various video related paths
video_dir_rel: "videos",
video_dir_abs: Path.join(File.cwd!(), "videos"),
video_source_dir_abs: Path.join(Path.join(File.cwd!(), "videos"), "source"),
video_target_dir_abs: Path.join(Path.join(File.cwd!(), "videos"), "rendered")
video_source_dir_rel: Path.join("videos", "source"),
video_target_dir_rel: Path.join("videos", "rendered")
}
1 change: 1 addition & 0 deletions lib/mix/tasks/deploy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ defmodule Mix.Tasks.Deploy do
/assets/app.js
/assets/app.css
/suche?search_query=foobar
/images/thumbnails/936d92c42595877d0925a822fdb40837/0
/map/___static/9.988434,53.548873,9/720x493
),
&report_status_200?/1
Expand Down
4 changes: 4 additions & 0 deletions lib/settings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ defmodule Settings do
end
end

def r(:video_dir_abs), do: Path.join(File.cwd!(), r(:video_dir_rel))
def r(:video_source_dir_abs), do: Path.join(File.cwd!(), r(:video_source_dir_rel))
def r(:video_target_dir_abs), do: Path.join(File.cwd!(), r(:video_target_dir_rel))

def r(key), do: Application.fetch_env!(:veloroute, Settings) |> Map.fetch!(key)
end
2 changes: 1 addition & 1 deletion lib/video/serve_plug.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule Video.ServePlug do

plug Plug.Static,
at: "/#{@serve_path}",
from: Settings.c(:video_target_dir_abs),
from: Settings.c(:video_target_dir_rel),
gzip: false,
brotli: false,
headers: %{
Expand Down

0 comments on commit 1bd3871

Please sign in to comment.