Skip to content

Commit

Permalink
fix: check for nil before expanding path
Browse files Browse the repository at this point in the history
  • Loading branch information
woylie committed Jan 22, 2025
1 parent 234a002 commit 1af621f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/avrora/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ defmodule Avrora.Client do
else
def self, do: get(@opts, :config, __MODULE__)
def schemas_path, do: Application.app_dir(@otp_app, get(@opts, :schemas_path, "./priv/schemas"))
def registry_ssl_cacert_path, do: Path.expand(get(@opts, :registry_ssl_cacert_path, nil))
def registry_ssl_cacert_path do
if path = get(@opts, :registry_ssl_cacert_path, nil) do
Path.expand(path)
end
end

defp get(opts, key, default) do
app_opts = Application.get_env(@otp_app, unquote(:"Elixir.#{module}"), [])
Expand Down
4 changes: 4 additions & 0 deletions test/avrora/client_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,9 @@ defmodule Avrora.ClientTest do

assert Beta.Config.names_cache_ttl() == :infinity
end

test "when otp_app is set and registry_ssl_cacert_path is not set" do
assert Gamma.Config.registry_ssl_cacert_path == nil
end
end
end

0 comments on commit 1af621f

Please sign in to comment.