Elixir Library using service account to call Google APIs


I’m creating an Elixir lib that call Google APIs to perform some process, the connection is done using a service account that will be specified in the Google default environment :


I am wondering how I’m going to expose this variable (and the service account file also) when installing the LIB by an external application. I know that LIBs doesn’t have access to their config file config/*.exs

Thanks in advance

You can have the user of your lib provide you with the path by requiring they configure the value in their config.exs, something like config :goog_lib, service_account_path: xxx, then in your code you can get that with Application.fetch_env!(:goog_lib, :service_account_path)

But there are some important warnings in the Elixir library guidelines you should note about generally using application configuration and during compile time.