원격 구성 적용

📘

Remote Config

Remote Config is a feature that allows you to replace the values or properties being managed in the application with the parameter values defined in the Hackle dashboard, enabling real-time control of the application's behavior and settings. Parameters can be set for any property of the client/server application (e.g., button color, external link).

Move to the Remote Config screen in the Hackle dashboard to set parameter information and values according to the user identification rules. To apply the values set in the Hackle Remote Config screen to the application, you must use the following features provided by the Hackle SDK.

After applying the desired values to the code using the features provided by the Hackle SDK, you can easily change the values and rules in the Remote Config screen and apply the changes without deployment.

📘

Remote Config is available for SDK version 3.3.0 and above.

If you are using Remote Config, please apply SDK version 3.3.0 or higher when adding dependencies.

useRemoteConfig() or useLoadableRemoteConfig()

Using the useRemoteConfig() or useLoadableRemoteConfig() Hooks API, you can get a HackleRemoteConfig instance containing remote configuration information (set parameters and rules) for the user.

You can access the desired parameter and retrieve its value using the methods provided by HackleRemoteConfig.

// Returns an instance containing remote configuration information.
const remoteConfig = useRemoteConfig()

// Returns an instance containing remote configuration information. - Loadable usage
const {loaded, result} = useLoadableRemoteConfig()

Retrieving Remote Config Parameters

  • The HackleRemoteConfig returned by using the useRemoteConfig() or useLoadableRemoteConfig() Hooks API provides the getSync() method to retrieve parameter values.

  • Since the parameter values set in the Hackle Remote Config screen are in a key-value format, you can retrieve the set parameter values using the following methods according to the set parameter type.

🚧

Remove code related to Remote Config after archiving.

If you archive Remote Config parameters, you can no longer access the parameter information. Therefore, be sure to clean up the related code after archiving Remote Config parameters.

// Returns an instance containing remote configuration information.
const remoteConfig = useRemoteConfig()

// Get parameter value from remoteConfig using the get() method
const parameterValue = remoteConfig.getSync(parameterKey, defaultValue)

// Example of string type parameter value
const strValue = remoteConfig.getSync("parmeterKey", "defaultValue")

// Returns an instance containing remote configuration information. - Loadable usage
const { loaded, result } = useLoadableRemoteConfig()

if(loaded) {
  const parameterValue = result.getSync(parameterKey, defaultValue)
  const parameterValuePromise = result.get(parameterKey, defaultValue)
}
  • The parameterKey in the getSync() method is the key information set in the Remote Config parameter settings.

  • The defaultValue is the value returned when the remote configuration value cannot be determined. The entered defaultValue can be returned in the following situations:

A. A value of a different type than the type set in the Remote Config screen is entered
B. A non-set parameter key is called
C. Hackle SDK initialization fails
D. Incorrect or non-existent identifier information is entered
E. ETC

  • To correctly receive the set information, the defaultValue you entered and the type set in the Hackle Remote Config parameter screen must be the same.

  • The parameter types provided by the SDK are string, number, and boolean, and the JSON type set in the Remote Config parameter screen can be received as a string. The default value for the JSON type must be entered as a string type.