Files
rudder-csharp-sdk/skills/rudder-csharp-sdk/reference/remote-config.md
T
edmand46 1029f08fba Docs: skills/README/CHANGELOG for effects client rewrite
- scenarios.md rewritten for server-side execution + effects API
- realtime.md deleted; realtime/planstore references purged from docs
- CHANGELOG Unreleased: major bump + migration table
2026-09-04 14:18:05 +03:00

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

  • LoadAsync fetches all configs and rebuilds the cache. A config whose raw JSON has "active": false is excluded; a missing active flag means active.
  • Get<T> reads from the cache only and returns defaultValue when 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 through Convert.ChangeType. string values 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>.