From 04c96fafc406c4c085aa296c14fc7fc2489d7592 Mon Sep 17 00:00:00 2001 From: Silas Date: Thu, 24 Feb 2022 02:09:40 -0500 Subject: [PATCH] change local file upload location --- .gitignore | 4 ++-- lib/entendu_web/router.ex | 2 +- lib/entendu_web/uploaders/encrypted_link.ex | 2 +- {uploads => priv/uploads}/.gitkeep | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename {uploads => priv/uploads}/.gitkeep (100%) diff --git a/.gitignore b/.gitignore index 65b6e1b..3f8d40d 100644 --- a/.gitignore +++ b/.gitignore @@ -35,5 +35,5 @@ npm-debug.log /priv/cert/ dev.secret.exs -/uploads/* -!/uploads/.gitkeep \ No newline at end of file +priv/uploads/* +!priv/uploads/.gitkeep \ No newline at end of file diff --git a/lib/entendu_web/router.ex b/lib/entendu_web/router.ex index b6fb8b9..8ca6b02 100644 --- a/lib/entendu_web/router.ex +++ b/lib/entendu_web/router.ex @@ -18,7 +18,7 @@ defmodule EntenduWeb.Router do pipeline :authorized_files do plug AuthorizeLink - plug Plug.Static, at: "/uploads", from: Path.expand('./uploads'), gzip: false + plug Plug.Static, at: "/uploads", from: {:entendu "priv/uploads"}, gzip: false end pipeline :authorized_link do diff --git a/lib/entendu_web/uploaders/encrypted_link.ex b/lib/entendu_web/uploaders/encrypted_link.ex index f75d3c0..faf7a01 100644 --- a/lib/entendu_web/uploaders/encrypted_link.ex +++ b/lib/entendu_web/uploaders/encrypted_link.ex @@ -37,7 +37,7 @@ defmodule Entendu.EncryptedLink do # Override the storage directory: def storage_dir(version, {_file, scope}) do - "uploads/links/#{scope.id}" + "priv/uploads/links/#{scope.id}" end # Provide a default URL if there hasn't been a file uploaded diff --git a/uploads/.gitkeep b/priv/uploads/.gitkeep similarity index 100% rename from uploads/.gitkeep rename to priv/uploads/.gitkeep