Skip to content
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

Add ability for custom init without making a separate app #8

Open
ConnorRigby opened this issue Sep 20, 2017 · 1 comment
Open

Add ability for custom init without making a separate app #8

ConnorRigby opened this issue Sep 20, 2017 · 1 comment

Comments

@ConnorRigby
Copy link

ConnorRigby commented Sep 20, 2017

Heres a use case I think Bootloader could solve.

Our FW application has a dependency that relies on code that makes https network requests on start. (Bad practice, but we don't want to rewrite the dep.) The problem is, that app will try to make network requests, fail, then our FW application will never get started since it gets started async while network is still coming up.

config :bootloader,
  init: [:nerves_runtime, :nerves_network, :nerves_ntp, :problem_dep],
  app: :fw

The fix i suggested that worked was to have a separate dep between :nerves_ntp and :problem_dep as a path dependency that blocks until time (and therefor network) is up. but it is very bulky and cumbersome to have a separate app just for three lines of init code, and it also leaves a random process laying around.

Something i think bootloader could solve is laid our something like this:

config :bootloader,
   init: [:nerves_runtime, :nerves_network, :nerves_ntp, Fw.CheckTimeAndNetwork, :problem_dep],
   app: :fw

This would allow for a more robust init system without being to bulky. One thing that will be a problem is the :fw app will not be started so a user would not be able to access any started processes.

I think i remember seeing there might be an API for this already, i just haven't looked and it's not documented.

Thanks @cjfreeze for bringing this up

@entone
Copy link

entone commented Sep 20, 2017

It appears the handler configuration key is meant to handle certain things like this, however, it doesn't appear to be fully implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants