anuaralfetahe
Does elixir actualy compile the .exs files?
Recently I found out that changes made to the config.exs file did not apply to the running app.
I had to recompile and restart the app with iex -S mix.
I always thought that .exs files were not being compiled and interpreted when used.
Why keep configurations in the .exs file and not in the .ex if both are compiled?
I have read about runtime and compile time configurations and System.get_env/2 seems to be the only option for updating the configurations without actualy recompiling the app. If I am keeping my configurations in plain elixir in the runtime.exs file do I always need to recompile when making conf changes?
I would be very happy to hear how other people manage their application configurations. Thanks ![]()
Trending in Questions
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Hello !
We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
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
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










Marked As Solved
derek-zhou
I’d make a companion command-line tool that send/update the config in the server, through a UNIX domain socket. You can use a HTTP API as @IloSophiep suggested but then you’d need to worry about securing the HTTP endpoint with auth.
Also Liked
derek-zhou
Elixir is a compiled language. The only difference between .ex and .exs is the .ex file is compiled and written out as a binary file on the disk, but the .exs is compiled on the fly into memory and not serialized out.
The typical usage of
runtime.exsis to read values from environment variables then config the application at runtime. So you don’t change runtime.exs, only the startup script that set those environment variables.In most web applications, the majority of the configurations are admin changeable from the UI, and those are typically backed by the database. The amount of flat file configuration is kept low. We don;t want to restart the application too often, right?
stefanchrobot
config/config.exsis read during build time andconfig/runtime.exsis read during application startup. Both of them are evaluated only once. To change the config of your app while it’s running, you need to do a bit of work yourself. I don’t think Elixir provides any tools for that out of the box.Qqwy
Be aware however, that there are quite a number of tools which only look at the configuration when they themselves first start up (which is usually at elixir-application-startup time), after which changing the configuration settings using e.g.
Application.put_envmight have little effect.Check the particular tool(s) you are using to be sure if/when it reads the configuration.
(And generally speaking it is nice if tools are able to pick up new configuration at runtime, because it is not rare to want to alter how something behaves at runtime at all.)
Last Post!
anuaralfetahe
Thank you all for the answers.
Many good ideas heres.
For my use case unix domain socket seems the best solution, because I have ssh access to the server and this way I don’t need to open the port 80 and 443 to the outside world, so the application can make connections to the servers but not the other way around.