IEx definition of home directory

In the section The .iex.exs file includes " then a global one (located at ~/.iex.exs )".

My initial interpretation is that ~ means the home directory of the user invoking the command.
However, this does not appear to be the case when starting a remote_console; the ~ is being interpreted at the home directory of the user the app was started as. (This is from a distillery (2.1.1)-created release on Elixir 1.8.2/OTP22)

Does that seem like expected/correct behavior? If so, are there any workarounds to have the individual’s .iex.exs file eval’d instead?

From my point of understanding, remote_console just connects to the already running node, similar to how telnet or SSH would do, and iex is driven by the remote. The remote can’t know about your local config, buit only sees its own.


I’m not sure this argument holds up. I’m starting the command in a shell with access to my environment, including my own ~/.iex.exs. The fact that the running node it’s connecting to might or might not be on a different system seems irrelevant.

And if this is the case, it’s surprising behavior inasmuch as any shell command I can think of treats ~ as the home directory of the user invoking it. So at the very least I think the doc needs clarification.

When you SSH into a different computer, what environment do you expect to see? Your local one or the remote one?

I don’t know why we should talk about SSH instead of Elixir and Distillery, but since you asked – when I start up SSH, yes, I expect it to configure itself with data read from my home directory, by default ~/.ssh/config.

Therefore I do not see an intrinsic difference between that and remote_console reading ~/.iex.exs.

If in fact the two ~ symbols here refer to conceptually different things, then again I’d say the docs need to clarify that. I’d prefer to have them work the same, though :grinning:

Yes, SSH configures itself for the connection, but the shell you use on the remote fetches its config from the remote.

So does remote_shell, it opens up a connection to the server and runs in the context of the already existing BEAM instance.

OK, for the record –

The /opt/appname/current/bin/appname remote_console command is part of the release and is available and run on the deployment server where the the app is running. It is “remote” only in name.

The command is run from a shell and as such has access to my environment and my home directory at startup. So when I see a reference to ~/.iex.exs there is no obvious (to me) reason not to assume the tilde means what it normally means, and the file referred to is in my home directory.

But that not being the case, I created a PR to clarify the language ( and it’s already merged. So now we know :grinning::heart: to Jose for responsiveness!.

Note: I would still like to be able to have per-user remote_console configuration options, so if anyone has ideas about that please share.

1 Like

It is a remote console in the sense that it runs from a separate VM than application itself.