DEV Community 👩‍💻👨‍💻

Cover image for Unleash brings powerful Constraints feature to OSS users
Roman Kalkowski for Unleash

Posted on • Originally published at getunleash.io

Unleash brings powerful Constraints feature to OSS users

Unleash is the largest open-source feature flagging solution on Github, that gives developers greater control over how to deploy new features. There are 12 official client and server SDKs and 10+ community SDKs available for greater flexibility and control over data and feature management deployment.

One of Unleash’s most requested Enterprise features is now available to all users.

You spoke, we listened: Available now, all open-source users of Unleash who upgrade to version 4.16 will get access to strategy constraints and custom context fields.

Add strategy constraints to your Unleash today

Image description Image description

What are Strategy Constraints?

Strategy constraints give you granular control over who gets to see a specific feature by adding preconditions to one of your activation strategies. You can add preconditions for any Unleash context field. As of version 4.16, Unleash supports 15 different constraint operators, fine-tuned for a number of use cases.

Here’s an example: A gradual rollout strategy could target 50% of a user base. But what if you want to only target users with a company email? For that, you’ll need strategy constraints.

Quickly schedule feature releases and feature availability windows. Target feature rollout to users based on variables like region or email address domain. Generate user demand with time-limited feature releases. There are a ton of ways to use strategy constraints, and this is only scratching the surface.

Any strategy on any feature can have as many strategy constraints as you want. Note that when a strategy is evaluated, all strategy constraints must be met for the strategy to pass.

You’ll find that, in most cases, strategy constraints replace the need for custom activation strategies. This means that you no longer need to define custom strategies, then implement them across your SDKs.

How do I use strategy constraints?

Note: Before creating strategy constraints, you’ll need to set up a feature toggle in Unleash, then give it an activation strategy.

Open the constraints menu
Find and select the edit strategy button on the strategy you are working with.

"edit strategy" button on the strategy screen

Click the "add constraint" button to open the constraints menu.

"add constraint" button

Add and configure the constraint

  1. From the "Context Field" dropdown, select the context field you would like to constrain the strategy on. Choose a constraint operator.
  2. Define the values to use for this constraint. The operator you select determines whether you can define one or multiple values and what format they can have.
  3. Save the constraint, then save the strategy.

Add and configure the constraint

If you want to update an existing constraint, find the constraint in the edit strategy screen and use the constraint’s edit button.

Because strategy constraints use Unleash context fields, make sure you pass the relevant context to your client SDK. Read more in the SDK section of our the SDK section of the strategy constraints documentation.

Strategy constraints are available today to all version 4.16 open source users

While strategy constraints are now free to all users, you won’t have access to the feature unless you upgrade to version 4.16. For users with versions 4.0 and above, you can grab the latest version from the Docker hub. Users of earlier versions should reference our migration guide before upgrading.

Feel free to play around first! Try out our demo instance to get a quick taste of what strategy constraints can do.

In the mood to dig around? Visit Unleash on GitHub to check out the strategy constraints source code.

Want to try out strategy constraints?

Image description

Top comments (0)

Update Your DEV Experience Level:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠