# `Stevedore.Plug`
[🔗](https://github.com/oshlabs/stevedore/blob/v0.2.0/lib/stevedore/plug.ex#L2)

A `Plug` implementing the OCI/Docker Distribution **v2 registry API**.

Mount it in a host router or run it standalone via `Stevedore.start_link/1`. Storage is a
directory tree (the `Stevedore.Transport.Static` layout) given as `:store`; in-progress blob
uploads live in a `Stevedore.Server.Uploads` process given as `:uploads`. Authn/authz is the
host's responsibility through the `:authorize` seam.

Endpoints: version check, manifest GET/HEAD/PUT/DELETE, blob GET/HEAD/DELETE, chunked blob
upload sessions (with monolithic and cross-repo mount shortcuts), `_catalog`, `tags/list`, a
stub referrers endpoint, and a `/token` endpoint for the standalone case.

## Options

  * `:store` — filesystem root for registry data (required)
  * `:uploads` — the `Stevedore.Server.Uploads` server (name or pid, required for pushes)
  * `:authorize` — `(conn, action, scope -> :ok | {:error, :unauthorized})` where `action` is
    `:pull | :push | :delete`. Default: allow pull, deny writes.
  * `:realm` — token realm advertised in `WWW-Authenticate` (default: derived from the request)

Spec: [distribution-spec](https://github.com/opencontainers/distribution-spec/blob/main/spec.md).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
