vegabook
How to specifiy location of DETS table files for a library
I’m writing a Bloomberg terminal API library for Elixir, and this library will need to store some mutable startup configuration in a DETS table. Specifically, ticker streams that are subscribed to during a session can (optionally) be stored, reloaded the next time a session is started, and resubscribed-to.
So now I need a file location for the DETS table. I could force one on users for example ~/.lib_name/application_name_subs.dets, but it seems right to be able to allow users to override such a location.
Problem is the library guidelines says one should avoid application-level configuration.
But in the case I mention, I’m going to guess application level configuration for such an override option is okay? What are the alternatives for the above?
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #performance











First 4 of 4 Posts
al2o3cr
Where in the code is a session “started”? That’s where I’d start looking for a place to supply config.
For instance, here’s how Oban does it (from the installation guide):
vegabook
Yeah so basically Oban is using global application configuration file?
benwilson512
Nope, see how it’s scoped under your app? And even that is a convention, you can just supply config directly to the child and skip the app env entirely.
al2o3cr
The difference is small but important:
A good way to check if you’re on the right path is to ask “can there be two of them?”
in the “don’t” case, there’s nowhere for that second config to go. Back when umbrella apps had separate
configdirectories per-app, people would try to configure the same app differently in different child apps only to discover that all the app configs were always loadedin the “do” case, all it takes is more of the same: