Documentation

Configuration

Flipper Cloud offers a variety of configuration options as well as adapters so you can be confident it works smoothly with your application.

With Flipper Cloud, each project environment receives its own set of API tokens so Flipper connects to the correct environment for flag states. So each environment in your application will have its own credentials—except for test which uses an in-memory adapter for performance.

You'll want to be sure that your credentials correspond to the correct environments for the project in Flipper Cloud. Most often, this would mean setting up the tokens for production and staging environments. Each team member always receives their own local development environment and will need to configure their local settings using that.

Finding your Secret Tokens

To find your Flipper Cloud token, go to the "Tokens" settings in the environment settings (Organization > Project > Environment > Settings > Tokens) for the relevant project environment in Flipper Cloud.

For the Cloud sync secret—which is optional—go to the "Webhooks" settings (Organization > Project > Environment > Settings > Webhooks) for the relevant environment for the project.

Regardless of your configuration approach, the Flipper Cloud sync_secret value is optional and uses Flipper Cloud webhooks to perform syncs of your feature data slightly faster than normal.

Using Environment Variables

Environment variables provide the easiest way to configure Flipper Cloud. Set a FLIPPER_CLOUD_TOKEN environment variable using .dotenv or any other approach that works with environment variables, and Flipper will recognize it and handle the rest.

FLIPPER_CLOUD_TOKEN=<your-cloud-token>
FLIPPER_CLOUD_SYNC_SECRET=<your-webhook-secret>

Using Rails Credentials and an Initializer

If you use Rails credentials, you can add an entry for the Flipper Cloud token to your credentials for each environment. Then you can use an initializer to configure Flipper using the values stored in credentials.

Once you have your relevant secrets, edit the credentials files for each of the environments you want to connect to Flipper Cloud.

bin/rails credentials:edit --environment=<environment-name>

Then, depending on the version of the Flipper gem you have locally, you can connect credentials to Flipper Cloud with one of two strategies.

Flipper 1.1 or Newer

If you're using version 1.1 or newer of the Flipper gem, it will automatically detect the relevant values from each environment's credentials file as long as the credentials are specified in the following format.

config/credentials/<environment>.yml.enc
flipper:
  cloud_token: <your-cloud-token>
  cloud_sync_secret: <your-webhook-secret>

If your credentials files use a different organization, you can use a Flipper configuration block to set up the values for different sets of keys based on the structure in your credentials files. See the next section on configuring Flipper 1.0 or earlier for an example.

Flipper 1.0 or Earlier

If you're using version 1.0 or earlier, you can load the credentials in a Flipper configuration block. In addition to configuring tokens, Flipper offers a variety of other configuration options. View all Flipper configuration options.

config/initializers/flipper.rb
Flipper.configure do |config|
  config.default do
    options = {
      token: Rails.application.credentials.dig(:flipper, :cloud_token),
      sync_secret: Rails.application.credentials.dig(:flipper, :cloud_sync_secret),
    }
    Flipper::Cloud.new(options)
  end
end
Ready to try it out?

Get audit history, rollbacks, advanced permissions, analytics, and all of your projects in one place.


Prefer our Cloudless option?

You can choose from several tiers to sponsor Flipper on GitHub and get some great benefits!

The Friday Deploy

Get updates for all things Flipper—open source and cloud.

Have questions? Need help?

Email us any time or head on over to our documentation or status page for the latest on the app or API.

Ready to take Flipper for a swim?

No credit card required. 14-day free trial. And customer support directly from the developers.