FeatureFlipper.Definition (feature_flipper v0.1.1)

DSL for defining feature flippers.

This module provides macros for defining feature flippers with metadata and automatically generates functions for each defined flipper.

Usage

defmodule MyApp.FeatureFlippers do
  use FeatureFlipper.Definition

  define_flipper :use_warehouse_cache_tbs_2221?, %{
    deadline: ~D[2025-06-30],
    description: "Use warehouse cache for improved performance"
  }

  define_flipper :enable_warehouse_cache_mirroring_tbs_2395?, %{
    deadline: ~D[2025-06-30],
    force_disable: false,
    description: "Enable cache mirroring for data consistency"
  }

  define_flipper :user_rate_tariff_manager_tbs_2873?, %{
    deadline: ~D[2025-06-30],
    key: "custom_tariff_key",  # Optional custom Consul key
    description: "Use new tariff manager for user rates"
  }
end

This will automatically generate functions:

  • MyApp.FeatureFlippers.use_warehouse_cache_tbs_2221?()
  • MyApp.FeatureFlippers.enable_warehouse_cache_mirroring_tbs_2395?()
  • MyApp.FeatureFlippers.user_rate_tariff_manager_tbs_2873?()

Summary

Functions

Use this module to enable the feature flipper DSL.

Define a feature flipper with metadata.

Functions

__using__(opts)

(macro)

Use this module to enable the feature flipper DSL.

define_flipper(name, metadata \\ %{})

(macro)

Define a feature flipper with metadata.

Parameters

  • name - The name of the feature flipper (atom)
  • metadata - A map containing flipper metadata

Metadata Options

  • :deadline - Date when the feature should be removed (Date struct)
  • :description - Human-readable description of the feature
  • :force_disable - Force disable in non-production environments (boolean, default: false)
  • :key - Custom Consul key (string, optional)

Examples

define_flipper :my_feature, %{
  deadline: ~D[2025-06-30],
  description: "My awesome feature",
  force_disable: false
}