Settings should maybe look in the current application's directory
andrewvy opened this issue · 2 comments
This is more of an enhancement to help ease those who use Distillery, the problem is that the mappings in priv/elasticsearch
won't match the right priv path when released into production, as something like:
indexes: %{
albums: %{
settings: "priv/elasticsearch/albums.json"
# ...
}
}
would not search in the currently running release directory.
I implemented a naive solution in andrewvy@b2bed7d which uses Application.app_dir/2
to get the running application's priv folder, but this loses the ability for those who may be pointing to paths outside of their application. Let me know if this is something worth adding! (Separate option, fallback lookup?)
@andrewvy Thanks for this! Is there any reason you couldn't do the app dir lookup in the settings themselves? Something like this:
albums: %{
settings: Application.app_dir(:my_app) <> "priv/elasticsearch/albums.json"
}
Ah, the information is only correct at runtime. But I totally skipped over and realized I can just use Elasticsearch.Cluster.init/1
to provide runtime config anyways, making this a non-issue. :)