ApiManagementConsoleV2.Features (api_management_console v0.1.0)

Copy Markdown View Source

Feature flag system based on license tier.

Each feature is registered with a minimum required tier. Add new features here as they're built — no other code changes needed.

Usage

if Features.enabled?(:audit_log) do
  # render audit log section
end

Adding a new feature

Just add it to @features with the required tier:

@features %{
  ...
  scheduled_toggles: :paid
}

Summary

Functions

Returns true if route count exceeds free tier limit.

Audit log retention in days.

Returns the integer cap or the total, whichever is smaller.

Returns a feature comparison matrix for the Plans modal.

Returns the current tier for display purposes.

Check if a feature is enabled for the current license tier.

Returns the license expiry date if set.

Max number of users allowed.

Max number of routes allowed. Returns :unlimited for paid.

Number of routes hidden beyond the cap.

Returns true if the license is in a trial period.

Functions

at_route_limit?(total_routes)

Returns true if route count exceeds free tier limit.

audit_retention_days()

Audit log retention in days.

capped_route_count(total_routes)

Returns the integer cap or the total, whichever is smaller.

comparison()

Returns a feature comparison matrix for the Plans modal.

Each entry has:

  • :name — feature display name
  • :free — what free tier gets
  • :paid — what paid tier gets

current_tier()

Returns the current tier for display purposes.

enabled?(feature)

Check if a feature is enabled for the current license tier.

Returns true if the feature's minimum tier is satisfied.

Examples

iex> Features.enabled?(:route_discovery)
true

iex> Features.enabled?(:nonexistent)
false

expires_at()

Returns the license expiry date if set.

max_admins()

Max number of users allowed.

max_routes()

Max number of routes allowed. Returns :unlimited for paid.

routes_over_cap(total_routes)

Number of routes hidden beyond the cap.

trial?()

Returns true if the license is in a trial period.