Closed whatyouhide closed 11 months ago
@tompave to be clear: ideally, I don't think fun_with_flags
should have an application callback module at all. I think we should start both manually. But that would be a breaking change for fun_with_flags
(albeit one that I would definitely support!).
Hi, I'm sorry that this stuff still a bit clunky.
On removing the applications callback: yes, that's definitely how I'd do it now. It's something for v2.0, though.
In the meantime, would this paragraph from that section of the FWF readme help?
One final note on this topic is that if you're also using
FunWithFlags.UI
(...), then that will need to be configured as well. The reason is that:fun_with_flags
is a dependency of:fun_with_flags_ui
, so including the latter as a dependency will cause the former to be auto-started despite the configuration described above. To avoid this, the same configuration should be used for the:fun_with_flags_ui
dependency, regardless of the approach used (Option A:runtime: false
,app: false
; or Option B:included_applications
).
Doing that worked for me when I tested different setups, but maybe your config is different (or something has changed in Elixir).
@tompave for some reason yesterday adding runtime: false
to :fun_with_flags_ui
didn't work, but it does today. I was under the impression that even with :fun_with_flags_ui, runtime: false
then dependencies of fun_with_flags_ui
, which include fun_with_flags
, would be started.
In any case... Is a v2.0 on the horizon? I'd be more than happy to help out with everything required to make that happen. This is such a foundational library (and such a well-made one!) in the Elixir ecosystem that I'd love to bring it up to speed with best practices 🙃
but it does today
So you're unblocked? That's great!
For v2.0, my main three goals are:
config.exs
file, and rather do something like what Ecto does. The host application should define its own module (like an Ecto repo!), and then call use FunWithFlags.SomeDescriptiveName
. And most config should be provided with an init
callback in the custom module.I started working on 1
some time ago. I need to resume that.
Closing this as it was resolved.
We use
fun_with_flags
as suggested in its README, that is:runtime: false
FunWithFlags.Supervisor
manually in our application's supervisorIf I try to use
fun_with_flags_ui
, this becomes problematic.fun_with_flags_ui
listsfun_with_flags
as a dependency withoutruntime: false
. This means that thefun_with_flags
application gets started anyways.I think what we'd want to do in
fun_with_flags_ui
is:fun_with_flags
as dependency withruntime: false
fun_with_flags_ui
'sApplication
module, we manually startFunWithFlags.Supervisor
Thoughts?