flipt logo

Flipt - OpenFeature Ruby provider

This repository contains the Ruby provider for Flipt, a feature flagging and experimentation platform.

In conjunction with the OpenFeature SDK you can use this provider to integrate Flipt into your Ruby application.

For documentation on how to use Flipt, please refer to the Flipt documentation.

Installation

Add this line to your application's Gemfile:

gem 'openfeature-flipt-provider'

And then execute:

$ bundle

Usage

To use the Flipt provider, you need to create an instance of the provider and pass it to the OpenFeature SDK.

require "open_feature/sdk"
require "openfeature/flipt/provider"

OpenFeature::SDK.configure do |config|
  config.set_provider(
    OpenFeature::Flipt::Provider.new(
      namespace: "flipt-namespace",
      options: {
        url: "https://url-to-flipt-server",
        update_interval: 60,
        authentication: "token"
      }
    )
  )
end
client = OpenFeature::SDK.build_client

# Check if a feature is enabled
if client.fetch_boolean_value(flag_key: "featureEnabled", default_value: false)
  puts "Feature is enabled"
else
  puts "Feature is disabled"
end

For a complete list of configuration options, such as authentication and error strategies, refer to the Flipt Client Ruby SDK documentation.

Contributing

https://github.com/open-feature/ruby-sdk-contrib