You can call Application.stop and Application.start. On Fri, Sep 24, 2021 at 1:10 PM Dan Calancea <d4no0...@gmail.com> wrote:
> Now the only question is: is it possible to restart elixir application > programatically from code? I couldn't find any related documentation on > this. > On Friday, September 24, 2021 at 1:37:11 PM UTC+3 José Valim wrote: > >> In addition to what Jon wrote, it is worth keeping in mind that >> config/runtime.exs is mostly a wrapper around Application.put_env/4 with >> option persistent: true, as you well noted, so you can implement the >> functionality you need using those functions if necessary. >> >> On Fri, Sep 24, 2021 at 12:17 PM Jon Rowe <ma...@jonrowe.co.uk> wrote: >> >>> Hi Dan >>> >>> Attempting to answer question 2, the most recent version of elixir adds >>> runtime.exs to replace/improve on releases.exs which runs at boot of an >>> Elixir app from mix or a release, see >>> https://hexdocs.pm/elixir/Config.html#module-config-runtime-exs >>> >>> Cheers >>> Jon >>> >>> On Fri, 24 Sep 2021, at 10:39 AM, Dan Calancea wrote: >>> >>> Let's suppose we have a elixir service that spawns some workers to do a >>> job, the supervisor takes configuration from config and starts the workers. >>> Now the classic way to configure such a project in prod is to use >>> *releases.exs*, where you can configure environment variables and the >>> release will reload the configuration*.* >>> >>> What I want to implement now is a dashboard that will control multiple >>> services configuration, this means that there should be a centralized >>> storage for configuration and some kind of signaling when to change >>> configuration. >>> >>> Let's suppose we use postgres, some tables to store the configuration >>> and custom signaling/ postgres NOTIFY to notify that the configuration has >>> changed and needs to be reloaded. >>> >>> The questions that arise are: >>> >>> 1. Is it possible/recommended to change the *releases.exs *file >>> responsible for configuration in a release so that the new configuration >>> is >>> persisted across reloads? >>> 2. Is it possible to implement this for dev environment? since as >>> far as I know dev environment does not support runtime configuration >>> currently. >>> 3. Is it intended behavior that *releases.exs *replaces >>> configuration added with *Application.put_env/4 *with option *persistent: >>> true*? >>> >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to elixir-lang-co...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-core/d274f872-3b2a-48ed-880e-363c36dcda36n%40googlegroups.com >>> <https://groups.google.com/d/msgid/elixir-lang-core/d274f872-3b2a-48ed-880e-363c36dcda36n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to elixir-lang-co...@googlegroups.com. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-core/70083903-4d63-46d6-88c6-9a0e95f67aa0%40www.fastmail.com >>> <https://groups.google.com/d/msgid/elixir-lang-core/70083903-4d63-46d6-88c6-9a0e95f67aa0%40www.fastmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elixir-lang-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/86eba7be-ce1d-4a84-81ba-a90f8195c4cdn%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/86eba7be-ce1d-4a84-81ba-a90f8195c4cdn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4KRF1fjMagwQnhdkgwgHSqRe40ySDC3-1etWPVgOtPbYg%40mail.gmail.com.