tompave / fun_with_flags_ui

Web dashboard for the FunWithFlags Elixir package
MIT License
128 stars 29 forks source link

Can't use this library if using `fun_with_flags` with `runtime: false` #37

Closed whatyouhide closed 11 months ago

whatyouhide commented 11 months ago

We use fun_with_flags as suggested in its README, that is:

If I try to use fun_with_flags_ui, this becomes problematic. fun_with_flags_ui lists fun_with_flags as a dependency without runtime: false. This means that the fun_with_flags application gets started anyways.

I think what we'd want to do in fun_with_flags_ui is:

Thoughts?

whatyouhide commented 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!).

tompave commented 11 months ago

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).

whatyouhide commented 11 months ago

@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 🙃

tompave commented 11 months ago

but it does today

So you're unblocked? That's great!

For v2.0, my main three goals are:

  1. Config overhaul. Stop using the 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.
  2. Start behaviour. It should never start automatically.
  3. Stop relying on atoms. Use binaries wherever possible. Relying on atoms that way make some things harder, especially when handling user input in the UI package.

I started working on 1 some time ago. I need to resume that.

tompave commented 11 months ago

Closing this as it was resolved.