Rebar3 vm.args Not Working

Hi everyone! Wondering if anyone else is seeing the same issue as I am.

While starting my app, I need to force a nodename, this is mainly so that my freeswitch instance can connect properly and data can flow back and forth between the two systems.

My vm.arg file looks like this:

-name ``my_app@127.0.0.1
-setcookie 123456abc123
+K true
+A 16

And the relevant parts of my rebar.config file looks like:

{shell, [

{apps, \[outbound_controller\]},

{config, "config/sys.config"},

{vm_args, "config/vm.args"}

]}.

relx…

{sys_config, "config/sys.config"},

{vm_args, "config/vm.args"}

However when I run rebar3 shell, and then run node(). it is ALWAYS nonode@nohost

Is there a reason why this is failing? Is there some way to force it? Or should I just write a shell script that launches and passes the proper info through from the start?

Thanks everyone!

vm_args is not a valid entry for rebar3 shell configuration, where did you find it?

To specify name and cookie you can use distribution options which will act as intended.

However, if you need something more than name and cookie, you can’t specify vm.args in rebar.config because rebar3 itself is a VM that reads that config and it’s impossible to apply vm.args after VM is started.

What you can use is ERL_FLAGS env variable to specify args file, e.g.: env ERL_FLAGS="-args_file config/vm.args" rebar3 compile.

relx entry is ok, but that’s applied only to the release, not rebar shell.

2 Likes

you need this e.g.:
rebar3 shell --name my_app@127.0.0.1 --setcookie “123XXX“
because shell don’t vm_args valid

You’re not going to like the answer to ‘where did you find it’

Just going to store variables like that as an app variable rather than passing it through in args

You need to add the following configuration to rebar.config.

{dist_node, [
    {setcookie, '123456abc123'},
    {name, 'my_app@127.0.0.1'}
]}.

Please refer to rebar3 document for details.