Remote Config
Remote Config is a feature that allows you to replace values or properties managed in your application with parameter values defined in the Hackle Dashboard, enabling real-time control of your application's behavior and configuration.
Navigate to the Remote Config screen on the Hackle Dashboard to configure parameter information and set values based on user identification rules.
useRemoteConfig() or useLoadableRemoteConfig()
Using the useRemoteConfig() or useLoadableRemoteConfig() Hooks API returns a HackleRemoteConfig instance containing the Remote Config information (configured parameters and rule information) for the user. You can access the desired parameter and retrieve its value through the methods provided by HackleRemoteConfig.
// 원격 구성 정보를 담은 인스턴스를 반환합니다.
const remoteConfig = useRemoteConfig()
// 원격 구성 정보를 담은 인스턴스를 반환합니다. - Lodable 사용 시
const {loaded, result} = useLoadableRemoteConfig()Querying Remote Config Parameters
The
HackleRemoteConfigreturned by theuseRemoteConfig()oruseLoadableRemoteConfig()Hooks API provides agetSync()method for querying parameter values.Since parameter values configured in Hackle's Remote Config screen exist in key-value format, you can use the following method based on the configured parameter type to retrieve the configured parameter value.
Remove Remote Config-related code after archiving.
Once a Remote Config parameter is archived, you can no longer access parameter information. Therefore, after archiving a Remote Config parameter, be sure to clean up the related code.
// 원격 구성 정보를 담은 인스턴스를 반환합니다.
const remoteConfig = useRemoteConfig()
//remoteConfig 에서 get() 메소드를 통해 parameter 값 가져오기
const parameterValue = remoteConfig.getSync(parameterKey, defaultValue)
// string 유형의 parameter값 예제
const strValue = remoteConfig.getSync("parmeterKey", "defaultValue")
// 원격 구성 정보를 담은 인스턴스를 반환합니다. - Lodable 사용 시
const { loaded, result } = useLoadableRemoteConfig()
if(loaded) {
const parameterValue = result.getSync(parameterKey, defaultValue)
const parameterValuePromise = result.get(parameterKey, defaultValue)
}The
parameterKeyin thegetSync()method is the key configured in the Remote Config parameter settings.defaultValueis the value returned when the Remote Config value cannot be determined. ThedefaultValueyou entered may be returned in the following situations: A. A value of a different type than the type configured on the Remote Config screen is entered B. An unconfigured parameter key is called C. Hackle SDK initialization failure D. Invalid or non-existent identifier information is provided E. ETCTo correctly retrieve the configured value, the
defaultValueyou enter and the type configured on the Hackle Remote Config parameter screen must match.The Remote Config parameter types provided by the SDK are string, number, and boolean. The JSON type configured on the Remote Config parameter screen can be received as a string (String). The default value for JSON type must be entered as a string type.
Last updated