-
Notifications
You must be signed in to change notification settings - Fork 79
Description
Summary
Adapter config interfaces currently require certain fields to be explicitly provided. The factory functions (create*Adapter) do auto-resolve from env vars, but the underlying config types (SlackAdapterConfig, DiscordAdapterConfig, TeamsAdapterConfig, etc.) mark these fields as required — meaning consumers who construct adapters directly must pass them explicitly even when env vars would suffice.
The request is to make the config types more ergonomic: accept config overrides when provided, but automatically fall back to env vars when fields are omitted — i.e., make the config fields optional at the type level.
Current Behavior
Several adapter configs require fields explicitly:
SlackAdapterConfig—signingSecret: stringandlogger: Loggerare requiredDiscordAdapterConfig—botToken,publicKey, andapplicationIdare all required stringsTeamsAdapterConfig—appId,appPassword, andloggerare requiredGoogleChatAdapterConfig—loggeris required, auth fields are split across union typesTelegramAdapterConfig—botTokenis requiredLinearAdapterConfig—webhookSecret,userName, andloggerare requiredGitHubAdapterConfig—webhookSecret,userName, andloggerare required
The factory functions (e.g. createSlackAdapter, createDiscordAdapter) already resolve these from env vars, but the class constructors don't — they expect the values to be present.
Desired Behavior
Make all adapter config fields optional (or provide sensible defaults), so that:
- Users can call
new SlackAdapter({})ornew DiscordAdapter({})and have env vars auto-resolved - Explicit config values override env vars when provided
- The factory functions remain the recommended API, but direct construction also "just works" with env vars
This would align the class constructors with the factory functions, which already implement the config ?? process.env.X pattern.
Context
Raised by @cramforce — who originally wrote the current explicit config pattern and now wants to make it more ergonomic.
Affected Packages
@chat-adapter/slack@chat-adapter/discord@chat-adapter/teams@chat-adapter/gchat@chat-adapter/telegram@chat-adapter/linear@chat-adapter/github