Koople
Search…
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
Javascript
C#
Java
1
import {PFClient} from "@pataflags/sdk-js";
2
3
const user = { id: '[email protected]', country: 'gondor', age: 31 }
4
const pfclient = PFClient.initialize('YOUR_API_KEY', user);
5
6
pfclient.onReady(() => {
7
const remoteConfig = pfclient.valueOf('theme');
8
}
Copied!
1
var pfclient = PfClient.Initialize('YOUR_API_KEY');
2
3
var attributes = new[] {
4
new PfUserAttribute("country", 'gondor'),
5
new PfUserAttribute("age", 31)
6
};
7
8
var user = PfUser.Create('[email protected].io', attributes);
9
var remoteConfig = pfclient.ValueOf('theme', user);
10
Copied!
1
PFClient pfclient = PFClient.initialize('YOUR_API_KEY');
2
3
PFUser user = PFUser.create('koople@koople.io');
4
.with("country", "gondor")
5
.with("age", 31);
6
7
String remoteConfig = pfclient.valueOf('theme', user);
Copied!
Copy link