Skip to content

Commit

Permalink
Load proper catalog path in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 committed Oct 3, 2022
1 parent 4b4a47e commit c1395a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 8 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 4 additions & 8 deletions lib/wanda/catalog.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand All @@ -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,
Expand Down

0 comments on commit c1395a3

Please sign in to comment.