-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
callback_port config compiled into plug at compile time #174
Comments
Could this be due to the phoenix plug compilation, by any chance? https://hexdocs.pm/plug/Plug.Builder.html#module-options the It happened to me before outside |
It's configurable, yes, but having the return value for |
I am not sure what you mean precisely. I do remember that if some plugs want to read things from the environments and rely on |
Whats the status on this one? |
So I guess the issue would come down to the fact that Providers are initialized during compilation time? |
After talking with @LostKobrakai on Slack we determined that this boils down to not being able to set any option at runtime due to Plugs being pre-initialized. Thus this makes this related to #170 |
My general take, it is frustrating that such behavior is controlled by The primary question here is, what We use 🤷🏻 🤷🏻 🤷🏻 🤷🏻 No clue, I think it is worth to bring the conversation to I would say, move things to the |
Plug
It is there to validate and possibly restructure the plug opts passed as input to init/1. Those opts commonly come from the second parameter of the The issue here is that |
So the technical problem here is that the code we want needs to be executed only once, lazily before first call. Ideally we would like to not have to compute this value every time plug is called. The computation should be very light and only passing but maybe shoving this into ets for cache would be an option? There is also an option to move this computation to the runtime.exs file, but that smells like an antipattern. Another option would be to maybe add that into the startup_phase, so its precomputed and then stored in something like ETS or dynamically loaded modules. But that also smells. Maybe first iteration to call the init in the call as previous mentioned? Is there a possibility of this breaking existing code? Should there be an explicit switch to enable this in new iterations of the providers? |
@Hajto keep it simple, like Joe said: make it work, make it beautiful and if you really really need to, make it fast. Moving the opts to |
Steps to Reproduce
Use
runtime.exs
to customize the port used for the callback url. E.g.providers: [name: {Strategy, [callback_port: 443]}]
Expected Result
Port to be applied.
Actual Result
Port is not used, because strategy config is compiled into the plug.
The text was updated successfully, but these errors were encountered: