Skip to content

Commit c3f1f62

Browse files
committed
mix: Add application definition
Prior to this change, Mix would not invoke `khepri_app:start/2` when starting the Khepri application (for example in `iex -S mix`). Transaction functions created within IEx would fail since the persistent term `{khepri,skipped_modules_in_code_collection}` was undefined. This change adds the `application/0` function suggested in the [`mix compile.app`](https://hexdocs.pm/mix/1.14.0/Mix.Tasks.Compile.App.html) documentation. The Erlang `app.src` file already provides the `applications`, `mod`, `env`, and `registered` options necessary to configure the Khepri application, so we inherit the values directly from `src/khepri.app.src`.
1 parent 3cd6c8b commit c3f1f62

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mix.exs

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ defmodule Khepri.MixProject do
1919
]
2020
end
2121

22+
def application do
23+
{:ok, [app]} = :file.consult("src/khepri.app.src")
24+
{:application, _app_name, props} = app
25+
26+
Keyword.take(props, [:applications, :env, :mod, :registered])
27+
end
28+
2229
defp deps() do
2330
# To avoid duplication, we query rebar.config to get the list of
2431
# dependencies and their version pinning.

0 commit comments

Comments
 (0)