I’ve done some work on Phoenix plugs and they have the init()
method that is used to pass arguments to the plug at compile time. How can I do that with my own modules? I know module attributes are evaluated at compile time…
Relatedly, how can I read config values that are set using the module name, e.g. like what is done in Phoenix with its web Endpoint.
config :my_app, MyAppWeb.Endpoint, [some: "thing"]
How do I get that “thing” from there? Is it as simple as Application.get_env(:my_app, MyAppWeb.Endpoint)
?
Many thanks!