explicitly set the app dir

This commit is contained in:
byte[] 2019-12-25 13:47:00 -05:00
parent 567459bf48
commit 481e29fd50
2 changed files with 7 additions and 2 deletions

View file

@ -28,7 +28,8 @@ config :philomena,
channel_banner_file_root: "priv/static/system/images", channel_banner_file_root: "priv/static/system/images",
tag_file_root: "priv/static/system/images", tag_file_root: "priv/static/system/images",
cdn_host: "", cdn_host: "",
proxy_host: nil proxy_host: nil,
app_dir: File.cwd!()
config :philomena, :pow, config :philomena, :pow,
user: Philomena.Users.User, user: Philomena.Users.User,

View file

@ -46,10 +46,14 @@ defmodule Philomena.Servers.Config do
defp maybe_update_state(state, _key, _true), do: state defp maybe_update_state(state, _key, _true), do: state
defp load_config(name) do defp load_config(name) do
with {:ok, text} <- File.read("config/#{name}.json"), with {:ok, text} <- File.read("#{app_dir()}/config/#{name}.json"),
{:ok, json} <- Jason.decode(text) {:ok, json} <- Jason.decode(text)
do do
json json
end end
end end
defp app_dir do
Application.get_env(:philomena, :app_dir)
end
end end