Search code examples
erlangelixirerlang-otpelixir-iex

How to start an iex session with cookie and erl options


If I start an IEx session in the following manner the cookie is set correctly.

$ iex --name example@10.10.10.2 --cookie mycookie -S mix
...
iex(example@10.10.10.2)1> :erlang.get_cookie
:mycookie

However if I also set erlang arguments to get use my sys.config file the cookie is not set correctly.

$ iex --name example@10.10.10.2 --cookie mycookie --erl "config sys.config" -S mix
...
iex(example@10.10.10.2)1> :erlang.get_cookie
:USLOPZLYUPUYMEGXBMJQ

How can I set both a config and cookie as command line arguments?


Solution

  • The erlang configuration to set a cookie is setcookie not cookie. Can be solved by starting as follows.

    $ iex --name example@10.10.10.2 --erl "-config sys.config -setcookie mycookie" -S mix