Packages

A BEAM-native service mesh gateway for Phoenix umbrella applications with automatic service discovery. Tenant handling is owned by each Phoenix application.

Current section

Files

Jump to
ex_service_mesh_router lib shared tenant_resolver.ex
Raw

lib/shared/tenant_resolver.ex

defmodule Router.Shared.TenantResolver do
@moduledoc """
Extracts tenant from request host inside Phoenix apps.
"""
def resolve(host) do
case String.split(host, ".") do
[tenant, _service, _tld] ->
{:ok, tenant}
_ ->
:error
end
end
end