Tenex.Plug (Tenex v1.0.4)

View Source

This module have some basic functions for our tenex plugs.

The plugs we have for now are:

Summary

Functions

Ensure the tenant is loaded, and if not, halts the conn.

Puts the given tenant as an assign on the given conn, but only if the tenant is not reserved.

Functions

ensure_tenant(conn, config)

Ensure the tenant is loaded, and if not, halts the conn.

The config map/struct must have:

  • assign: the name of the assign where we must save the tenant.

put_tenant(conn, tenant, config)

Puts the given tenant as an assign on the given conn, but only if the tenant is not reserved.

The config map/struct must have:

  • tenant_handler: function to handle the tenant param. Its return will be used as the tenant.
  • assign: the name of the assign where we must save the tenant.