Multitenancy.Plug.ResolveSite (multitenancy_phoenix v0.2.0)

Copy Markdown View Source

Resolves the request into a site and assigns :current_site and :current_theme. Hosts in :platform_hosts are left untouched so they can be served by the platform router. Any other unknown host gets a 404, except under :platform_paths, which are served on every host.

plug Multitenancy.Plug.ResolveSite,
  resolver: Multitenancy.SiteResolver.YAML,
  platform_hosts: ["localhost"],
  platform_paths: ["/admin"]

The resolver's Multitenancy.SiteResolver.resolve_conn/1 is used when defined, Multitenancy.SiteResolver.resolve/1 with the host otherwise.

Summary

Functions

Stores site and its theme in the connection.

Resolves conn with resolver.

Functions

put_site(conn, site)

Stores site and its theme in the connection.

resolve(resolver, conn)

Resolves conn with resolver.