문제

It seems like that we can launch Mnesia only by typing iex --erl "--mnesia dir '~/doc/'" --name mynode.

Can we just launch it without passing arguments to erl?

도움이 되었습니까?

해결책

You can set it up dynamically in your code. All the --erl instruction above does is to configure the mnesia application before it is started. You could achieve this by:

# First load mnesia
iex(1)> :application.load(:mnesia)
:ok
# Now configure the desired directory
iex(2)> :application.set_env(:mnesia, :dir, 'sample')
:ok
# Start mnesia as usual
iex(3)> :mnesia.start
:ok
# See if the desired info is correct
iex(4)> :mnesia.info
:ok

Notice it only works if you start the application manually. If you are starting it automatically and want to configure through the command line, your current snippet is the best option (or using ELIXIR_ERL_OPTS).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top