akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

How are you handling run-time configuration for Plugs? (poll)

I was wondering how people are handling run-time configuration of their Plugs in their Phoenix applications as of today:

  • Using {:system, “ENV_VAR”} tuple (if lib supports it)
  • Using Mix Releases & Config module (if lib supports it)
  • Wrap Plug libraries with your own Plugs to control configuration
  • I don’t need run-time configuration of plugs
  • Other (please add comment as to what you use)

0 voters

I am also curious what problems people encounter with configuring Plugs at run-time and if people would like to see some community best practices/guidelines around Plugs that allow them to be more configurable in a deployed setting (maybe documentation like this exists and I just don’t know about it??).

Personally, I have been going the route of having my Plug libraries configurable via the Config module and my config/releases.ex file.

Thanks for the input, and stay safe during these tough coronavirus days!!

Most Liked

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

I think it gets to the fundamental problem of what can you do during build-time, and what has to wait during run-time. For example, you may have a CORS plug, but that requires inputs for valid origins. You could pre-populate the list of origins so that it is known at build time, or you could defer that decision to run-time and populate that list with an env var. The latter may be ever so slightly slower, but you also net having your build artifacts be environment agnostic and portable. I def agree that whatever can be determined at build time, should be done when the application is compiled.

As for the performance cost…I think it depends. If you configuration is in an env var or app config, the look up time is negligible. If your config if a network hop away…then yes. At which point you should reach for something like https://hexdocs.pm/elixir/master/Config.Provider.html to resolve the configuration and store it in app config (at run-time).

Where Next?

Popular in Polls Top

thojanssens1
In an attempt to figure out what are the preferred GraphQL clients for Elixir developers, I made this poll below. If you’re using GraphQL...
New
AstonJ
poll asdf Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more Manage multiple runtime versions with a ...
New
AstonJ
What is your primary dev OS? And is there any software you’d like to recommend that could make development easier? (Apart from the code e...
New
AstonJ
Following on from a conversation in the Tidewave thread - how useful do you think AI dev tools are right now and how useful do you think ...
New
AstonJ
Curious whether you remap your Caps Lock key.. Do you remap your Caps Lock key? poll I have no idea what Globe is btw, just seen it in t...
New
akoutmos
I was wondering how people are handling run-time configuration of their Plugs in their Phoenix applications as of today: poll I am also ...
New
ryanswapp
I think it would be interesting to see how most people are using Phoenix in production. Do you use it as an API backend for a SPA? Or do ...
New
hst337
Do you use hot-reload/recompilation in production? Please note that this poll is only about BEAM’s internal features of runtime upgrades ...
New
AstonJ
How often do you buy a new dev machine? poll If there is any particular reason why you’ve settled on the frequency you have, please shar...
New
axelson
I’m working on VSCode ElixirLs syntax highlighting, and different themes support different syntax definitions. So I am curious about whic...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New

We're in Beta

About us Mission Statement