slouchpie
Using project's .iex.exs with gigalixir ps:remote_console
Gigalixir lets us start a remote shell, similar to iex --remsh. The command is:
gigalixir ps:remote_console -a my-app
Does anyone know if there is a way to make this shell use my project’s .iex.exs. I want this because my .iex.exs contains lots of nice aliases. I get very tired of typing alias MyApp.SomeContext.SomeModule.
Marked As Solved
jesse
Perhaps you can try adding the .iex.exs file as an overlay to get it included in the release. mix release — Mix v1.20.2
Also Liked
slouchpie
I’ve said it before and I’ll say it again. This forum is sooo good. The advice people give is such high-quality. It’s like living next to the Mage’s Guild.
slouchpie
LostKobrakai
Last Post!
slouchpie
The benefit of iex.exs is being able to print helpful reminder messages in a production/staging/dev shell.
Example:
is_staging = !!System.get_env("IS_STAGING")
mix_env =
case {System.get_env("MIX_ENV"), Application.get_env(:my_app, :env)} do
{"prod", :prod} -> :prod
{_, :test} -> :test
{_, :dev} -> :dev
_ -> :unknown
end
print_warning = fn message ->
IO.puts(IO.ANSI.red_background() <> message <> IO.ANSI.blink_rapid() <> IO.ANSI.reset())
end
print_info = fn message ->
IO.puts(IO.ANSI.cyan_background() <> message <> IO.ANSI.reset())
end
print_warning_if_prod = fn ->
case {mix_env, is_staging} do
{:prod, false} ->
for message <- ["⚠ REMINDER:", "👿 THIS IS THE PROD SHELL!", "🙇 PLEASE BE CAREFUL."] do
print_warning.(message)
end
{:prod, true} ->
print_warning.("👷 this is the staging shell")
{_, _} ->
print_info.("Welcome to MyApp, Dev 👽")
end
end
print_warning_if_prod.()
print_info.(" 🌎 Your region: " <> System.get_env("FLY_REGION", "local-dev"))
With the above (or similar) in the iex.exs file, connecting to remote shells is safer. The developer is reminded of the environment.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









