Skip to content

Commit

Permalink
create_apikey_for_admin/1 in seeds.exs for #55
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Apr 28, 2020
1 parent 52b4f36 commit 3cdd44c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions priv/repo/seeds.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,25 @@ defmodule Auth.Seeds do

IO.inspect(person.id, label: "seeds.exs person.id")
IO.puts("- - - - - - - - - - - - - - - - - - - - - - ")

person
end

def create_apikey_for_admin(person) do

{:ok, key} = %{"name" => "default key", "url" => "http://localhost:4000"}
|> AuthWeb.ApikeyController.make_apikey(person.id)
# |> IO.inspect(label: "apikey_params")
|> Auth.Apikey.create_apikey()

# IO.inspect(key, label: "key")
api_key = key.client_id <> "/" <> key.client_secret
# Set the AUTH_API_KEY to a valid value that is in the DB:
System.put_env("AUTH_API_KEY", api_key)
IO.inspect(System.get_env("AUTH_API_KEY"), label: "AUTH_API_KEY")
key
end
end

Auth.Seeds.create_admin()
|> Auth.Seeds.create_apikey_for_admin()

0 comments on commit 3cdd44c

Please sign in to comment.