Closed maciej-szlosarczyk closed 1 year ago
Thanks for the report @maciej-szlosarczyk and sorry for the very cryptic messaging.
Remove Application.compile_env(:ecto, :json_library)
I didn't know this - will definitely remove
Application.compile_env(:ex_cldr, :json_library)
I'm still a bit confused on the behaviour since in the example app (thanks very much, greatly appreciated) the config :phoenix, json_library: Jason
is still compile time so I'm surprised its being reported as Compile time value was not set
. I'll try some further experiments today. However given your report, removing the ability to use whatever Phoenix uses for a json_library
makes sense if there's no other resolution
What are your thoughts on auto configuring Jason
or Poison
if they are available at compile time? (that's the current behaviour).
For the next release cycle of ex_cldr
aligned to CLDR 44 the local data will be in erlang term format, not json. This should result in faster compile times and remove the requirement for a json library at all.
Hey @kipcole9, thank you for a very quick change!
I think the change introduced in https://github.com/elixir-cldr/cldr/commit/fef2f97aa5de0350a4ec6688bb97875fc239edd4 is the best choice. Judging by number of downloads on hex.pm Jason and Poison are by the most popular JSON encoders for Elixir, but folks still have an option to adjust if they want to use something less common.
I've published ex_cldr version 2.37.2 with the following changelog entry:
:json_library
in config.exs
and checking for Phoenix configuration can cause config failures when building in Docker. Thanks to @maciej-szlosarczyk for the report. Closes #208.Thanks for the report and collaboration.
ex_cldr reads other applications' configuration values at compile time, namely phoenix's and ecto json_library.
There are two separate issues here:
Ecto does not defined json_library
According to this issue, ecto has moved the json_library config value down to adapter level (i.e postgrex). ex_cldr reads non-existent config value.
Problems while building Docker images
Reading other applications configuration at compile time can cause problems when building docker images - one of the ways docker images are build is that you build dependencies without config, in a separate step. Asciinema server does that:
https://github.com/asciinema/asciinema-server/blob/662b2098660dfcf5edc82a8cc652740f415bcfab/Dockerfile#L24-L25
This can cause pretty opaque failures:
I have create a reproduction case here: https://github.com/maciej-szlosarczyk/carbon, it reliably fails on every run of
docker build .
Proposed solutions