fxn

fxn

The release docs of Phoenix say to put

config :my_app, MyApp.Endpoint, server: true

in config/prod.secret.exs. However, while that file is processed when the release task runs, it is not processed when the release starts. The application resource file of Phoenix has serve_endpoints to false, and the resource file of the Phoenix application itself does not include application environment.

How does that flag end up in the release? Where is it stored and loaded?

Showing Posts 1 to 3

fxn

fxn OP

I suspect the key is the :persistent flag. Need to connect the dots from where is the flag set, to how persistent flags survive compilation.

wolf4earth

wolf4earth

The configuration of your config/config.exs files is - as you probably already know - evaluated at build time. In case of a release this is when you’re assembling the release.

The fully evaluated configuration is then written to the sys.config file in your release folder (which is an erlang file). Assuming you have an app called my_app and built a release for the prod environment with the app version 0.1.0 you can find it at _build/prod/rel/my_app/releases/0.1.0/sys.config.

Here is how it looks for a project of ours (with sensitive configuration replaced with ***):

[{distillery,
     [{config_providers,
          [{'Elixir.Distillery.Releases.Config.Providers.Elixir',
               [<<"${RELEASE_ROOT_DIR}/etc/config.exs">>]}]}]},
 {sasl,[{errlog_type,error},{sasl_error_logger,false}]},
 {facts,
     [{ecto_repos,['Elixir.MyApp.Repo']},
      {generators,[{binary_id,true}]},
      {'Elixir.MyAppWeb.Gettext',[{default_locale,<<"de">>}]}]},
      {'Elixir.MyAppWeb.Endpoint',
          [{url,[{host,<<"***">>}]},
           {secret_key_base, <<"***">>},
           {render_errors,
               [{view,'Elixir.MyAppWeb.ErrorView'},
                {accepts,[<<"html">>,<<"json">>]}]},
           {pubsub,
               [{name,'Elixir.MyApp.PubSub'},
                {adapter,'Elixir.Phoenix.PubSub.PG2'}]},
           {live_view,[{signing_salt,<<"***">>}]}]}]},
 {phoenix,[{json_library,'Elixir.Jason'}]},
 {logger,
     [{console,
          [{format,<<"$time $metadata[$level] $message\n">>},
           {metadata,[request_id]}]},
      {level,info}]},
 {sentry,
     [{included_environments,[<<"production">>,<<"staging">>]},
      {enable_source_code_context,true}]}].

While this particular project is using distillery to assemble the release the process is fundamentally the same of you use elixir releases.

fxn

fxn OP

Aaahh, indeed, I believe there was a day in which I knew that, had totally forgotten it. Thanks!

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
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
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
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