Remote Config Appliance
Remote Configuration
Remote Configuration is a feature that allows you to control an application's behavior and settings in real-time by replacing the values or properties managed within the application with parameter values defined in the Hackle dashboard. Parameters can be set for all properties of client/server-side applications (e.g., button colors, external links).
To configure parameter information, navigate to the Remote Config page in the Hackle dashboard, where you can set parameter values and configure values based on user identification rules. To apply the values set on the Hackle Remote Configuration page to your application, you must make use of the following functions provided by the Hackle SDK:
By utilizing the functions provided by the Hackle SDK to apply the values you wish to configure in your code, you can easily make changes to values and rules on the Remote Configuration page without the need for deployment.
remoteConfig
When you invoke the RemoteConfig()
method, you can obtain an instance of hackle.RemoteConfig
that contains remote configuration information (configured parameters and rules) for a user. RemoteConfig()
requires user identification information to match user attributes with the rules in remote configuration. You can access values for the desired parameters through the methods provided by hackle.RemoteConfig
.
import "github.com/hackle-io/hackle-go-sdk/hackle"
// User object - Refer to the user identifier and attributes guide
user := hackle.NewUserBuilder().ID("ae2182e0").Build()
// Obtain an instance containing remote configuration information.
remoteConfig := hackleClient.RemoteConfig(user)
Retrieving Remote Configuration Parameters
Since parameter values set on the Hackle Remote Configuration page exist in key-value pairs, you can use the following methods to retrieve the configured parameter values based on their types:
Remove Code Related to Storing Remote Configuration Afterward
Once you have archived remote configuration parameters, you won't be able to access parameter information anymore. Therefore, after storing remote configuration parameters, be sure to clean up the related code.
GetString
- Returns the parameter value set as STRING or JSON.
import "github.com/hackle-io/hackle-go-sdk/hackle"
// User object - Refer to the user identifier and properties guide
user := hackle.NewUserBuilder().ID("ae2182e0").Build()
// Obtain an instance containing remote configuration information.
remoteConfig := hackleClient.RemoteConfig(user)
stringValue := remoteConfig.GetString("string_key", "default_value")
// JSON Type
jsonValue := remoteConfig.GetString("json_key", "{}")
GetNumber
- Returns the parameter value set as a Number type as a float64.
import "github.com/hackle-io/hackle-go-sdk/hackle"
// User object - Refer to the user identifier and properties guide
user := hackle.NewUserBuilder().ID("ae2182e0").Build()
// Obtain an instance containing remote configuration information.
remoteConfig := hackleClient.RemoteConfig(user)
numberValue := remoteConfig.GetNumber("number_key", 42.0)
GetBool
- Returns the parameter value set as a Boolean type.
import "github.com/hackle-io/hackle-go-sdk/hackle"
// User object - Refer to the user identifier and properties guide
user := hackle.NewUserBuilder().ID("ae2182e0").Build()
// Obtain an instance containing remote configuration information.
remoteConfig := hackleClient.RemoteConfig(user)
boolValue := hackleClient.GetBool("bool_key", false)
Updated about 1 year ago