xgeek116
Elixir Library using service account to call Google APIs
Hello,
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 :
GOOGLE_APPLICATION_CREDENTIALS=path/service_account.json
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
First Post!
03juan
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.
Popular in Questions
Other popular 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
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









