IEx.configure doesn't work in release

I was trying to customize iex prompt so that it will show different env name(by reading it from system env) in release mode. The purpose is to alert myself that I am interacting with a shell in one env(so that it’s harder to mistake production shell as staging shell).

However it looks like IEx.configure has no effect in remote console. I wonder if someone know what’s reason? And is there other workaround to do the customize prompt thing in release?

Thank you very much.

1 Like

Remote consoles are fun in that your prompt is on a local instance but the process executing what you type is remote. So, you might be configuring the wrong prompt. It might work to take self/0 (the process executing what you type), run it through Process.group_leader/1, take its node, then RPC a call to IEx.configure there. Pretty does this in reverse to get your local console’s inspection settings. It’s something like this:

Process.group_leader() 
|> :erlang.node() 
|> :rpc.call(IEx.Config, :inspect_opts, [])
1 Like

I was trying to do exactly the same by putting the following in my runtime.exs

config :iex, default_prompt: "#{System.get_env("RENDER_SERVICE_NAME")} > "

But these settings are ignored when connecting to my release with remote command.

Found any solution?