AttestoPhoenix.Plug.PutConfig (AttestoPhoenix v2.14.2)

Copy Markdown View Source

Loads the host's validated Attesto configuration into conn.private.

AttestoPhoenix controllers use two immutable configuration values:

  • %AttestoPhoenix.Config{} under :attesto_phoenix_config
  • the derived %Attesto.Config{} under :attesto_protocol_config

Mount this plug in the pipeline passed to AttestoPhoenix.Router.attesto_routes/1:

pipeline :attesto_phoenix_config do
  plug AttestoPhoenix.Plug.PutConfig, otp_app: :my_app
end

scope "/" do
  attesto_routes(pipeline: :attesto_phoenix_config)
end

The explicit :otp_app option is preferred. When it is omitted, the plug reads config :attesto_phoenix, otp_app: :my_app at request time. Existing correctly typed private values are preserved, which lets a host install a request-specific configuration earlier in the pipeline. A value of the wrong type fails closed instead of being silently replaced.

Summary

Types

options()

@type options() :: %{otp_app: atom() | :from_application_env}