Outerfaces.Odd.Plugs.OddRevEndpointPlug (Outerfaces Dependency Distribution (ODD) v0.2.8)

View Source

Plug that serves the current revision as JSON at /__outerfaces__/rev.json.

This endpoint provides a fast, lightweight way for service workers to check the current revision without parsing HTML or fetching bootstrap files.

Usage

Add to your pipeline before OddCDNConsumerServeIndex:

plug OddRevEndpointPlug

Response Format

{
  "rev": "abc123def456",
  "schema_version": "1.0"
}

Options

  • :rev_scope - answers with that scope's rev (Outerfaces.Rev.current_rev/1) instead of the global one, for a host serving one project of several.

  • :metadata - {module, function, args} returning a map, carried in the response under "meta": whatever else a client should compare along with the rev. Called on every request, so it should be cheap. Without it there is no "meta" key.

    plug OddRevEndpointPlug, rev_scope: :docs_site, metadata: {MyApp.Deploy, :rev_meta, []}

Cache Headers

Always returns Cache-Control: no-store, no-cache, must-revalidate to ensure clients always get the current rev value.