如何使用cookie和erl选项启动iex会话

Pet*_*ton 3 erlang elixir erlang-otp iex

如果我IEx以下列方式启动会话,则cookie设置正确.

$ iex --name example@10.10.10.2 --cookie mycookie -S mix
...
iex(example@10.10.10.2)1> :erlang.get_cookie
:mycookie
Run Code Online (Sandbox Code Playgroud)

但是,如果我也设置了erlang参数来使用我的sys.config文件,那么cookie就没有正确设置.

$ 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
Run Code Online (Sandbox Code Playgroud)

如何将配置和cookie都设置为命令行参数?

Pet*_*ton 6

设置cookie的erlang配置setcookie不是cookie.可以通过如下开始解决.

$ iex --name example@10.10.10.2 --erl "-config sys.config -setcookie mycookie" -S mix
Run Code Online (Sandbox Code Playgroud)