Remote Config

As explained in the core concepts section, remote configurations are a development technique where an application's feature behaviour can be changed remotely without publishing an application update.

Let's see how to create a remote config in Koople!

A remote config needs a name and key. Like in the release toggles, the key is gonna autocomplete from the name. The key must be unique in the project, is the way Koople identify your remote config. If the key already exists, the platform will throw an error message when trying to create it, and the key must be changed to complete the process.

Pay particular attention to the "Server Only" checkbox. The remote configurations (and release toggles) marked as Server Only will be evaluated only by the server SDKs, never by the client SDKs. The main reason is that, for example, you may want to provide confidential information (for example, some configuration keys). For this reason, we will prevent it from appearing outside of trusted environments such as a web browser.

Now you can add the remote config value.

This is the most basic use of a remote config. Now, your application can get this value from remote. Changing the default value in the Koople platform to change the behaviour of your application without redeploying it.

It is possible to add variations to the remote config to return different values depending on some rules. The user that match the rules will get the variation value. The users that don't match with the rules will get the default value. You can add multiple variations in a remote config.

The complete list of operators:

  • is one of

  • is not one of

  • exists

  • doesn't exist

  • contains

  • does not contain

  • <

  • <=

  • >

  • >=

  • is truthy

  • is falsy

  • user in target group

  • user not in target group

Learn more about how to reuse rules using target groups.

It is possible to combine different rule with and/or operators.

Let's see how this works with the SDK

import {PFClient} from "@pataflags/sdk-js";

const user = { id: 'koople@koople.io', country: 'gondor', age: 31 }
const pfclient = PFClient.initialize('YOUR_API_KEY', user);

pfclient.onReady(() => {
    const remoteConfig = pfclient.valueOf('theme');
}

Last updated