hauleth

hauleth

Currently Phoenix.Endpoint relies on some compile time configuration options from config.exs file. While it works, it needlessly pollutes configuration file, and as a result it will end in sys.config for no reason. Instead it should be provided inline within MyApp.Endpoint directly, like in Ecto 3.0 when the adapter specification was moved from config to the Repo itself.

What is your opinion on such change?

Showing Posts 1 to 2

dimitarvp

dimitarvp

Splattering configuration all over the source is an absolute “NOPE” from me. Even the Repo way of doing it is an anti-pattern in this regard. Such way of doing things creates extra friction and adds WTFs due to additional cognitive load. I’d hate for Elixir to become a quirky niche tech that’s only understood by a small hardcore community due to the need to handle such dark magic like configuration potentially being everywhere in the source.

While I do agree on the sys.config part, I believe we should try really hard to have any and all configuration in one fixed directory in the project. But that circles back to the huge discussion on built-in standardized Elixir configuration mechanisms for (1) compile-time, (2) boot time and (3) runtime configuration, where the jury is still out.

hauleth

hauleth OP

It is not quirky IMHO. Just compile-time dependencies should be stored in code, not in configuration. If such approach would be more popular then it could improve such things and make Phoenix.LiveReload to not fail on configuration change (or do it less often). I do not see how:

config :my_app, MyApp.Endpoint,
  render_errors: [view: MyApp.ErrorView, accepts: ~w(html), layout: false]

Is more readable than:

defmodule MyApp.Endpoint do
  use Phoenix.Endpoint,
    render_errors: [view: MyApp.ErrorView, accepts: ~w(html), layout: false]

While with other options, like :debug_error we could dispute whether it would be better to keep them in config (as it would be easier to set them only in development), but IMHO at least :render_errors should be within module itself, not in application configuration.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
AstonJ
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New

Other Trending Topics Top

JesseHerrick
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
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews