Using DropConfig for Feature Flags
Tags: javascript, softwaredevelopment, featureflags
Published: 2019-06-05 15:51:19

---
title: Using DropConfig for Feature Flags
published: true
tags: javascript,software-development,feature-flags
canonical_url: https://medium.com/dropconfig/using-dropconfig-for-feature-flags-851de1706839
---

We’ll show how you can use DropConfig to manage your feature flags

### What are feature flags?

Feature Flags are a powerful technique, allowing you to change the behavior of your app without changing any code.

### The Config

We’ll create A DropConfig config for easy flag management.

{% gist https://gist.github.com/powerc9000/37fbc2d563a5d9e1c19cea1f6ac6c444 %}

#### Creating the document

Go to [https:](https://www.dropconfig.com)//www.dropconfig.com and click on Try Without Signup . We’ll be using an anonymous document for simplicity but you can create an account to keep your documents in.

Check out my version here [https://a.dropconfig.com/d21deb7f-f6ad-428d-be4d-c20cbffa2f3d.json](https://a.dropconfig.com/d21deb7f-f6ad-428d-be4d-c20cbffa2f3d.json)

![](https://cdn-images-1.medium.com/max/1024/1*UFrre6vkMbNd3hFErHlXfg.png)<figcaption>Document in the document editor</figcaption>

Remember to save and publish your config for it to show up!

#### Getting the document in our application

We’ll use some modern javascript feature to make this a bit easier to write and read.

First we need to note the access url for our document mine is: [https://a.dropconfig.com/d21deb7f-f6ad-428d-be4d-c20cbffa2f3d.json](https://a.dropconfig.com/d21deb7f-f6ad-428d-be4d-c20cbffa2f3d.json)

We will use it to get our document as json

{% gist https://gist.github.com/powerc9000/04a58630626f0c41ae82acb6dd5081e8 %}

It really is just that easy!

### Using feature flags in code

Now that we have all our flags pulled in we can use them in our application wherever we want.

Let’s make a function to get a flag from our flags and return if it is enabled

{% gist https://gist.github.com/powerc9000/770188ced50e85768f4b5cdefa6dd764 %}

Now wherever we want to turn feature on or off we can call isEnabled in our code.

{% gist https://gist.github.com/powerc9000/1ec7ef2556188aa1c87f243ebb34c388 %}

### Modifying and adding flags in the UI

DropConfig makes it easy to pass off a task to others without worrying they might break your JSON.

You can give product owners control of the feature flags easily just by the [Form UI](https://docs.dropconfig.com/docs/what-is-form-ui/) we have.

![](https://cdn-images-1.medium.com/max/1024/1*N_XLeIGaJOvcy836B4etpw.png)<figcaption>The form UI</figcaption>

To add a new feature flag all we need to do is click the + button and give it a name. Pretty foolproof.

![](https://cdn-images-1.medium.com/max/1024/1*1y9esbG5FQW4K1e-dbeVdA.png)<figcaption>A newly added flag</figcaption>

Next we can hit the enabled check box to turn the flag on or off!

![](https://cdn-images-1.medium.com/max/1024/1*kxH3ac6Hi1EfaPRbxPIOVg.png)<figcaption>A checked flag</figcaption>

After making changes make sure to save and publish the document to see the effect.

I hope this helps you use DropConfig for your feature flag needs and check out our other articles to see other great use cases for DropConfig.

* * *