Issues with environment variables in google_books
- Dominant language
- Elixir
- Stars
- 16
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
We keep running into a weird problem with environment variables. The google books api key is stored on GOOGLE_BOOKS_KEY and accessed via
```elixir
@key System.get_env("GOOGLE_BOOKS_KEY")
```
in google_books.ex. Weirdly the value is only recognised some of the time, so sometimes when @ZooeyMiller or I run the server we get errors due to the key being set to "". If we run `System.get_env` directly in a function instead of through `@key` it loads fine.
As a temporary solution we've moved `System.get_env` to the `create_url` function instead, and set envy up so it only loads `.env`s when not in Mix env test. This may not work in the long-term because sometimes tests need access to environment variables (for example when we add OAuth).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.