Skip to content

skylightio/skylight-phoenix

Repository files navigation

DirewolfPhoenixAgent

TODO: Add description

Installation

  1. Add Skylight to your list of dependencies.

  2. Add Skylight to your applications array.

  3. Configure in config/config.exs:

    • Add Skylight configuration options

      config :skylight,
        authentication: {:system, "SKYLIGHT_AUTHENTICATION"}
    • Set up as an instrumenter for your Endpoint:

      config :my_app, MyApp.Endpoint,
        instrumenters: [Skylight] # Add this line to existing config
  4. Add Plug to Endpoint (lib/APP/endpoint.ex)

    defmodule MyApp.Endpoint do
      # Add before first plug
      plug Skylight.Plug
    end
  5. Set up Ecto:

    • In lib/APP/repo.ex

      defmodule MyApp.Repo do
        use Skylight.Ecto.Repo # Add this line
      end
    • In config/prod.secret.exs

      config :my_app, MyApp.Repo,
        ...
        loggers: [{Ecto.LogEntry, :log, []}, {Skylight.Ecto.Logger, :log, []}] # Add this line
    • In web/web.ex

      Replace references to:

      alias MyApp.Repo

      with

      alias MyApp.Repo.Skylight, as: Repo

Development

$ mix deps.get
$ mix skylight.fetch
$ DIREWOLF_PHOENIX_TOKEN=TEST_APP_AUTH_TOKEN mix test

Notes

If you have issues with crypto/OpenSSL try installing Erlang from https://packages.erlang-solutions.com/erlang/.