flareConfig
function flareConfig<T extends Record<string, ConfigDescriptorValue>>(key: string, descriptor: T): ConfigToken<InferConfigShape<T>>Creates a typed config token for a top-level section of flare.json.
Pass a descriptor object whose keys are field names and whose
values are Flare primitives (string, int, bool, date). Mark a field
optional with optional(), defaultTo(), or schema(...).optional().
Required fields (bare primitives) must be present in the resolved config.
The descriptor is retained at runtime so FlareHost.build can validate
that all required fields are present. TypeScript infers the section type
directly from the descriptor; no manual type annotation needed.
Declare it at module scope, register it on the host via host.cfg(token),
and add it to static config on any class that needs it.
key string · The top-level key in flare.json that this token maps to.
descriptor T · Field descriptor keyed by field name. Required keys must appear in flare.json (or env).
returns ConfigToken<InferConfigShape<T>>
Example:
export const DbConfig = flareConfig('db', { url: str, password: str });
// host.tshost.cfg(DbConfig);
// db-service.tsclass DbService extends FlareService { static config = [DbConfig];
async onStart() { const { url, password } = this.config(DbConfig); }}Learn: Configure your app