Hyperlinkv0.8.0-beta.28

DynamicConfig

DynamicConfig.setByKeyconstsrc/DynamicConfig.ts:494
(key: string, value: string): Effect.Effect<
  void,
  Config.ConfigError | ConfigKeyNotSwappable,
  DynamicConfigStore
>

Swap by raw env key — the string-keyed path for remote/RPC handlers that don't hold a field (e.g. an RPC procedure that swaps an allowed key on its runtime). Enforces the per-runtime allowlist — the key must have been declared swappable — and validates the value through that key's Config.

utils
export const setByKey = (
  key: string,
  value: string,
): Effect.Effect<
  void,
  Config.ConfigError | ConfigKeyNotSwappable,
  DynamicConfigStore
> =>
  Effect.gen(function* () {
    const store = yield* DynamicConfigStore;
    const config = store.allowed.get(key);
    if (config === undefined) {
      return yield* new ConfigKeyNotSwappable({ key });
    }
    yield* config.parse(constProvider(value));
    yield* store.setRaw([[key, value]]);
  });