Skip to content

Commit

Permalink
use Envar.get to check AUTH_API_KEY for #65 see: dwyl/mvp#109 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Jul 20, 2022
1 parent 489b95b commit fb28a63
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Mix.Config

config :auth_plug,
api_key:
Expand Down
2 changes: 1 addition & 1 deletion lib/token.ex
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ defmodule AuthPlug.Token do
see: https://github.com/dwyl/auth/issues/42#issuecomment-620247243
"""
def api_key do
Application.fetch_env!(:auth_plug, :api_key)
Envar.get("AUTH_API_KEY", Application.fetch_env!(:auth_plug, :api_key))
end

# The regex group the 3 part of the env (id, secret and auth_url)
Expand Down
5 changes: 4 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule AuthPlug.MixProject do
def project do
[
app: :auth_plug,
version: "1.4.13",
version: "1.4.14",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down Expand Up @@ -53,6 +53,9 @@ defmodule AuthPlug.MixProject do
# Decoding JSON data: https://hex.pm/packages/jason
{:jason, "~> 1.3"},

# Check/get Environment Variables: https://github.com/dwyl/envar
{:envar, "~> 1.0.8"},

# Track coverage: github.com/parroty/excoveralls
{:excoveralls, "~> 0.14.3", only: :test},

Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"credo": {:hex, :credo, "1.6.5", "330ca591c12244ab95498d8f47994c493064b2689febf1236d43d596b4f2261d", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "101de53e6907397c3246ccd2cc9b9f0d3fc0b7805b8e1c1c3d818471fc85bafd"},
"dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},
"earmark_parser": {:hex, :earmark_parser, "1.4.25", "2024618731c55ebfcc5439d756852ec4e85978a39d0d58593763924d9a15916f", [:mix], [], "hexpm", "56749c5e1c59447f7b7a23ddb235e4b3defe276afc220a6227237f3efe83f51e"},
"envar": {:hex, :envar, "1.0.8", "109396b4abb6e94ad01c34dbd7064d9a231f723a5c2a0a91e6f24a8be9e3381b", [:mix], [], "hexpm", "033a546cd53950a2436eaa89c7e961325330d20c022d4edcbd14e461fca93c0b"},
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
"ex_doc": {:hex, :ex_doc, "0.28.4", "001a0ea6beac2f810f1abc3dbf4b123e9593eaa5f00dd13ded024eae7c523298", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "bf85d003dd34911d89c8ddb8bda1a958af3471a274a4c2150a9c01c78ac3f8ed"},
"excoveralls": {:hex, :excoveralls, "0.14.6", "610e921e25b180a8538229ef547957f7e04bd3d3e9a55c7c5b7d24354abbba70", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "0eceddaa9785cfcefbf3cd37812705f9d8ad34a758e513bb975b081dce4eb11e"},
Expand Down

0 comments on commit fb28a63

Please sign in to comment.