From c09a43f71ee7dfd70612d08dfad02a239eeaaa13 Mon Sep 17 00:00:00 2001
From: Thomas Citharel <tcit@tcit.fr>
Date: Tue, 16 Mar 2021 11:08:04 +0100
Subject: [PATCH] Get front-end index path at runtime instead of compile-time

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
---
 lib/web/views/utils.ex | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/web/views/utils.ex b/lib/web/views/utils.ex
index c21e2bf3a..043727116 100644
--- a/lib/web/views/utils.ex
+++ b/lib/web/views/utils.ex
@@ -7,13 +7,12 @@ defmodule Mobilizon.Web.Views.Utils do
   import Mobilizon.Web.Gettext, only: [dgettext: 2]
   import Plug.Conn, only: [put_status: 2, halt: 1]
 
-  @index_file_path Path.join(Application.app_dir(:mobilizon, "priv/static"), "index.html")
-
   # sobelow_skip ["Traversal.FileModule"]
   @spec inject_tags(Enum.t(), String.t()) :: {:ok, {:safe, String.t()}}
   def inject_tags(tags, locale \\ "en") do
-    with {:exists, true} <- {:exists, File.exists?(@index_file_path)},
-         {:ok, index_content} <- File.read(@index_file_path),
+    with path <- Path.join(Application.app_dir(:mobilizon, "priv/static"), "index.html"),
+         {:exists, true} <- {:exists, File.exists?(path)},
+         {:ok, index_content} <- File.read(path),
          safe <- do_replacements(index_content, MetadataUtils.stringify_tags(tags), locale) do
       {:ok, {:safe, safe}}
     else