Search code examples
erlangelixirmnesia

How to change/set :mnesia folder in elixir?


Is there a way to set mnesia folder in Elixir?

There is a way to set this folder using 'mnesia-dir' parameter in command line, but it is not a convenient way.


Solution

  • There are two ways:

    1- Add it in your config.exs:

    config :mnesia,
       dir: 'mydb_#{Mix.env}'
    

    2- Use environments:

    Application.put_env(:mnesia, :dir, '/tmp/wowdb')