dwyl / dwyl/library

Issues with environment variables in google_books

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.