import Config

config :bytepack,
  ecto_repos: [Bytepack.Repo]

config :bytepack, Bytepack.Repo, migration_timestamps: [type: :utc_datetime_usec]

config :bytepack, :stripe,
  host: Bytepack.Stripe.ProdHost,
  api_key: "[please-use-an-actual-api-key-here]",
  platform_id: "[please-use-an-actual-plataform-id-here]",
  secret_key_base: "[please-use-an-actual-secret-here]"

config :bytepack_web,
  ecto_repos: [Bytepack.Repo],
  generators: [context_app: :bytepack]

config :bytepack_web, BytepackWeb.Endpoint,
  url: [host: "localhost"],
  # This can be generated by running `:crypto.strong_rand_bytes(64) |> Base.encode64()`
  secret_key_base: "[please-use-an-actual-secret-here]",
  render_errors: [view: BytepackWeb.ErrorView, accepts: ~w(html json), layout: false],
  pubsub_server: Bytepack.PubSub,
  live_view: [signing_salt: "[please-change-to-rand-string]"]

config :bytepack_web, :csp_config,
  csp_directives: [
    {"connect-src", "'self' wss://*.bytepack.io stats.bytepack.io *.ingest.sentry.io"},
    {"default-src", "'self'"},
    {"style-src", "'self' 'unsafe-inline'"},
    {"script-src", [:nonce, "stats.bytepack.io"]},
    {"frame-src", ["'self'"]},
    {"img-src", ["'self'"]},
    {"font-src", "data:"}
  ]

config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id]

config :logger, Sentry.LoggerBackend,
  level: :warn,
  excluded_domains: [:cowboy],
  capture_log_messages: true

config :phoenix, :json_library, Jason

config :swoosh, :api_client, Bytepack.Extensions.Swoosh.FinchClient

config :sentry,
  dsn: "[please-use-an-actual-sentry-endpoint-here]",
  environment_name: Mix.env(),
  included_environments: [:prod],
  filter: Bytepack.Extensions.Sentry.Filter,
  client: Bytepack.Extensions.Sentry.FinchClient,
  release: System.get_env("SOURCE_VERSION")

config :libcluster,
  topologies: [
    bytepack: [
      strategy: Cluster.Strategy.Gossip
    ]
  ]

import_config "#{Mix.env()}.exs"
