I am having a helper module with some functions and macros which I will be using in different apps. Currently I created an umberall app with this command mix new kv_server --module KVServer --sup inside apps directory. But the configs of this new app I want to define in kv app like this
config :kv, KVServer,
key: “value”
(How do I get the configs in sub app or helper app?)
So I what want is I dont want to put a new app into the apps list and I want to get the configs in the child or sub or helper app(whatever it is called)
This helper app should be unaware of the app whatever parent app is using this app. So I think {:bar, in_umbrella: true} doesn’t fit in this situation. and how do I get the config in the sub app like Application.get_env(:parent_app, KVServer)[:secret_key] how do I know the parent app name
If the KVServer should get it’s configuration from another OTP app config, you probably need a mixin module like Ecto.Repo that is used to configure it:
defmodule MyApp.KVServer
use KVServer, otp_app: :my_app
end