1029f08fba
- scenarios.md rewritten for server-side execution + effects API - realtime.md deleted; realtime/planstore references purged from docs - CHANGELOG Unreleased: major bump + migration table
2.5 KiB
2.5 KiB
Remote config — client.RemoteConfig (RemoteConfigService)
Source: Services/RemoteConfigService.cs, RemoteConfig/*.cs (generated DTOs).
Methods and properties
public bool IsLoaded { get; } // true after first successful LoadAsync
public IReadOnlyDictionary<string, RemoteConfig> Configs { get; } // cache, keyed by config key
public Task<IReadOnlyDictionary<string, RemoteConfig>> LoadAsync(CancellationToken cancellationToken = default);
public Task<RemoteConfig> GetConfigAsync(string key, CancellationToken cancellationToken = default);
public T Get<T>(string key, T defaultValue = default!);
public Task<T> GetAsync<T>(string key, T defaultValue = default!, CancellationToken cancellationToken = default);
Endpoints: GET /sdk/v1/remote-configs (list), GET /sdk/v1/remote-configs/{key}.
Behavior notes
LoadAsyncfetches all configs and rebuilds the cache. A config whose raw JSON has"active": falseis excluded; a missingactiveflag means active.Get<T>reads from the cache only and returnsdefaultValuewhen the key is missing or the value cannot be parsed (it never throws on parse errors).GetAsync<T>loads the cache on first use, then reads from it.GetConfigAsync(key)fetches one config straight from the server, bypassing the cache.- Typed parsing honors the config's
valueType:number/int/integer/float/double(invariant culture),bool/boolean,json/object(deserialized via Newtonsoft.Json); anything else goes throughConvert.ChangeType.stringvalues are returned as-is.
Model (RudderSdk.Core.Models.RemoteConfig)
public class RemoteConfig
{
public bool? Active { get; set; } // "active"
public DateTimeOffset? CreatedAt { get; set; } // "createdAt"
public string? Description { get; set; } // "description"
public string? Environment { get; set; } // "environment"
public string? Id { get; set; } // "id"
public string? Key { get; set; } // "key"
public string? ProjectId { get; set; } // "projectId"
public DateTimeOffset? UpdatedAt { get; set; } // "updatedAt"
public string? Value { get; set; } // "value"
public string? ValueType { get; set; } // "valueType"
}
Scenario remote_config_override nodes are applied server-side and do not
reach the client. Call LoadAsync (or GetAsync) to observe the patched
value via Get<T>.