-
Notifications
You must be signed in to change notification settings - Fork 23
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
mix ua_inspector.download fails when using dynamic DB configuration #18
Comments
As a workaround, one can invoke the
Another solution might be to load configured apps before invoking config :ua_inspector,
init: {MyApp, :resolve_ua_inspector_db, ["ua_db"]},
load_apps: [:my_app] Changes to the mix task: --- /tmp/aaa.ex 2019-07-15 11:30:54.708207207 +0300
+++ /tmp/bbb.ex 2019-07-15 11:32:11.592203895 +0300
@@ -36,6 +36,12 @@
]
def run(args) do
+ load_apps = Application.get_env(:ua_inspector, :load_apps, [])
+
+ for app <- load_apps do
+ :ok = Application.load(app)
+ end
+
:ok = Config.init_env()
{opts, _argv, _errors} = OptionParser.parse(args, @cli_options) |
It looks like just loading an application will not work, at least locally for me: {:error, {'no such file or directory', 'ua_inspector_test.app'}} What however did work was calling But to at least make the mix task work properly having a way to start without getting "database file not found" messages might be the most simple solution available. |
Could you try the change (23958cf) I applied to the |
This one was just a guess, I didn't test it myself, sorry :) I should have made it clear.
Yes, it works! |
❤️ 💙 💚 💜 💛 The fix is now available in the newly release version |
I just updated to 1.2.0. |
I confirmed this breaks my builds; so I opened a new issue: #19 |
I store the database in my app's
priv
directory. At first, I specified the database path as a path relative to the project root:It worked in development and test environments, but didn't work in releases. So I switched to dynamic configuration:
MyApp.resolve_ua_inspector_db/1
is defined as follows:This works, but now when running
mix ua_inspector.download
, I get the following error:I figured the error happens because the mix task tries to use the code that is not loaded yet. I've tried it on versions 1.0.0 and 1.1.0.
The text was updated successfully, but these errors were encountered: