Closed ghost closed 3 years ago
I'm confused. Is your credentials file valid json?
I was also tripped up by this error.
I think it is a misunderstanding of this configuration option
config :goth,
json: {:system, "GCP_CREDENTIALS"}
Where I specified GCP_CREDENTIALS as a filename, and not a JSON string.
So either you need to get your full JSON into the environment var e.g.
export GCP_CREDENTIALS=`cat ~/.gcp/my-creds.json`
Or if like me you prefer to use a filename, change your config to something like:
config :goth,
json: System.get_env("GCP_CREDENTIALS_FILE") |> File.read!
Or if like me you prefer to use a filename, change your config to something like:
config :goth, json: System.get_env("GCP_CREDENTIALS_FILE") |> File.read!
One thing I would caution against related to this particular option is that this config is evaluated at compile time, not runtime, so reading an ENV var within the config file itself will read the var at compile time (which may not actually be what you'd want).
In #83 we're introducing a new API where you'd explicitly pass the configuration: if you already have a map, you pass it as is; if you have a filename, you need to read it and decode it; etc. I believe we can close this then.
I have an issue regarding decoding my json file.
config :goth, json: "config/gcs.json" |> Path.expand() |> File.read!()
is it possible to use
Jason.encode_to_iodata()
for the the keys to be decoded properly?