The flipt-client-ruby
directory contains the Ruby source code for the Flipt client-side evaluation client.
gem install flipt_client
If you are experiencing segfaults when using this gem, you may need to configure ffi
to use the system libffi instead of the bundled one.
You can do this before installing the gem by running the following command:
gem install ffi -- --enable-system-libffi # to install the gem manually
bundle config build.ffi --enable-system-libffi # for bundle install
In your Ruby code you can import this client and use it as so:
require 'flipt_client'
# namespace is the first positional argument and is optional here and will have a value of "default" if not specified.
# opts is the second positional argument and is also optional, the structure is:
# {
# "url": "http://localhost:8080",
# "update_interval": 120,
# "authentication": {
# "client_token": "secret"
# }
# }
#
# You can replace the url with where your upstream Flipt instance points to, the update interval for how long you are willing
# to wait for updated flag state, and the auth token if your Flipt instance requires it.
client = Flipt::EvaluationClient.new()
resp = client.evaluate_variant({ flag_key: 'buzz', entity_id: 'someentity', context: { fizz: 'buzz' } })
puts resp
-
To run the load test, you'll need to have Flipt running locally. You can do this by running the following command from the root of the repository:
docker run -d \ -p 8080:8080 \ -p 9000:9000 \ docker.flipt.io/flipt/flipt:latest
-
You'll also need to have the
flipt_client
gem installed locally. See Installation above. -
In the Flipt UI (http://localhost:8080) you'll also need to create a new boolean flag with the key
my-feature
in the default namespace. -
You can then run the load test by running the following command from this folder:
bundle exec ruby load_test.rb