-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5539590
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josevalim What is the reason for this change? For regular apps I guess this isn't needed, but we have a reusable Phoenix Endpoint, in which case we don't have any global config (we want the users just to be able to mount the endpoint). Our CI broke on this commit and it was just a matter of removing
@impl true
, but now I have an ugly warning message each time I start ;)5539590
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can either use config/runtime.exs or pass the options to the endpoint directly on start, such as
{MyApp.Endpoint, override: 123}
. As far as I can see, there isn't a benefit to this approach.5539590
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our case, the latter is way more convenient because we have tests with various different configurations and also scripts that start our system in different configurations. Using config/runtime.exs for all these usecases would get convoluted.
5539590
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said above, you don't need to use config/runtime.exs. You can pass the additional options as arguments in the supervision tree/start_link.
5539590
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I misunderstood your point. Arguments giving to the supervision tree works, but I lost a place to apply defaults then right? For example, we had something like this currently:
So the recommended approach then here would be to use a wrapper childspec that applies the defaults?
5539590
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can apply defaults by passing them to start_link and you can also read them by using Application.get_env.