dwyl / elixir-auth-github

:octocat: Minimalist GitHub OAuth Authentication for Elixir Apps. Tested, Documented & Maintained. Setup in 5 mins. 🚀
GNU General Public License v2.0
38 stars 4 forks source link

Use Environment Variables and Avoid Config Step #35

Closed nelsonic closed 4 years ago

nelsonic commented 4 years ago

At present the README.md recommends using Environment Variables but it requires you to add config settings to your config.exs: image

We could avoid the step and just inform people they must have GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET defined in order for the package to work.

nelsonic commented 4 years ago

Thinking of raising an error if the environment variables are undefined:

iex> raise ArgumentError, message: "Environment variables GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET undefined"

see: https://hexdocs.pm/elixir/Exception.html and: https://elixir-lang.org/getting-started/try-catch-and-rescue.html#errors

nelsonic commented 4 years ago

Alternatively the more succinct and fatal:

iex> exit("Environment variables GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET undefined")
** (exit) "Environment variables GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET undefined"

I want to figure out the appropriate way of doing Logging: https://github.com/dwyl/learn-elixir/issues/149

nelsonic commented 4 years ago

At present the /test/elixir_auth_github_test.exs file has 28 mentions of the word "env" ... image image Most of the tests include some reference to the "ENVIRONMENT VARIABLES NOT SET" ... This feels unnecessarily repetitive ... 🤔

nelsonic commented 4 years ago

Resolved by #34 ✅