# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config

# General application configuration
config :phoenix_api,
  ecto_repos: [PhoenixApi.Repo]

# Configures the endpoint
config :phoenix_api, PhoenixApi.Endpoint,
  url: [host: "localhost"],
  secret_key_base: "Y2tk0vLhaEfGnlYjCd215r9+3PxmNcEmP6NrG5ERqJd9dX69EbtigUi9kjCQmU61",
  render_errors: [view: PhoenixApi.ErrorView, accepts: ~w(html json)],
  pubsub: [name: PhoenixApi.PubSub,
           adapter: Phoenix.PubSub.PG2]

# Configures Elixir's Logger
config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id]

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"

# config Guardian
config :guardian, Guardian,
  hooks: GuardianDb,
  allowed_algos: ["HS512"], # optional
  verify_module: Guardian.JWT,  # optional
  issuer: "PhoenixApi",
  ttl: { 30, :days },
  allowed_drift: 2000,
  verify_issuer: true, # optional
  # generated using: JOSE.JWK.generate_key({:oct, 16}) |> JOSE.JWK.to_map |> elem(1)
  secret_key: %{"k" => "qvT_jaowhBQQ6PtncnWcPQ", "kty" => "oct"},
  serializer: PhoenixApi.GuardianSerializer

# config GuardianDB
config :guardian_db, GuardianDb,
             repo: PhoenixApi.Repo,
             sweep_interval: 120

config :phoenix_api, PhoenixApi.Mailer,
    adapter: Bamboo.SMTPAdapter,
    server: "smtp.gmail.com",
    port: 587,
    username: "demo.rails007",
    password: "mcmxcd123",
    tls: :if_available, # can be `:always` or `:never`
    ssl: false, # can be `true`
    retries: 3
