commanded / eventstore

Event store using PostgreSQL for persistence
MIT License
1.06k stars 146 forks source link

[Doc] Which application to load to run mix tasks using Elixir releases? #187

Closed datafoo closed 4 years ago

datafoo commented 4 years ago

Documentation indicates:

Initialize a database using a Elixir releases

[…]

defmodule MyApp.ReleaseTasks do
  def init_event_store do
    […]

    :ok = Application.load(:eventstore)

    […]
  end
end

Since I migrated to EventStore 1.0.0, Application.load(:eventstore) does not help. I get this error:

$ _build/prod/rel/my_app/bin/my_app eval "MyApp.ReleaseTasks.init_event_store()"
** (ArgumentError) MyApp.EventStore storage configuration not specified in environment
    (eventstore) lib/event_store/config.ex:13: EventStore.Config.get/2
    (eventstore) lib/event_store/config.ex:31: EventStore.Config.parsed/2
    lib/my_app/release_tasks.ex:12: MyApp.ReleaseTasks.init_event_store/0
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir) lib/code.ex:240: Code.eval_string/3

However, if I use Application.load(:my_app) it works:

$ _build/prod/rel/my_app/bin/my_app eval "MyApp.ReleaseTasks.init_event_store()"
The EventStore database has been initialized.

Is the current documentation accurate?

slashdotdash commented 4 years ago

The documentation needs to be updated for v1. Pull request gladly accepted!