From c1395a37e12b723fd0bdda05637755cf07214188 Mon Sep 17 00:00:00 2001 From: arbulu89 Date: Fri, 30 Sep 2022 16:17:39 +0200 Subject: [PATCH] Load proper catalog path in prod --- config/runtime.exs | 8 ++++++++ lib/wanda/catalog.ex | 12 ++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/config/runtime.exs b/config/runtime.exs index 92da83e1e..c7d8b9a4c 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -77,4 +77,12 @@ if config_env() == :prod do publisher: [ connection: amqp_url ] + + # Update catalog path to the current application dir during runtime + config :wanda, Wanda.Catalog, + catalog_path: + Application.app_dir( + :wanda, + Application.fetch_env!(:wanda, Wanda.Catalog)[:catalog_path] + ) end diff --git a/lib/wanda/catalog.ex b/lib/wanda/catalog.ex index 1989cbb1e..314a3bd61 100644 --- a/lib/wanda/catalog.ex +++ b/lib/wanda/catalog.ex @@ -9,14 +9,6 @@ defmodule Wanda.Catalog do Fact } - @doc """ - Get checks catalog path - """ - def get_catalog_path do - local_path = Application.fetch_env!(:wanda, Wanda.Catalog)[:catalog_path] - Application.app_dir(:wanda, local_path) - end - @doc """ Get a check from the catalog. """ @@ -27,6 +19,10 @@ defmodule Wanda.Catalog do |> map_check() end + defp get_catalog_path do + Application.fetch_env!(:wanda, Wanda.Catalog)[:catalog_path] + end + defp map_check(%{ "id" => id, "name" => name,