( configPath = DEFAULT_CONFIG_PATH, deps: ConfigWriterDeps = defaultDeps )
| 830 | config.plugins.entries[KILOCLAW_MORNING_BRIEFING_PLUGIN_ID] ?? {}; |
| 831 | config.plugins.entries[KILOCLAW_MORNING_BRIEFING_PLUGIN_ID].enabled = true; |
| 832 | |
| 833 | // Telegram |
| 834 | if (env.TELEGRAM_BOT_TOKEN) { |
| 835 | const dmPolicy = env.TELEGRAM_DM_POLICY || 'pairing'; |
| 836 | config.channels.telegram = config.channels.telegram ?? {}; |
| 837 | config.channels.telegram.botToken = env.TELEGRAM_BOT_TOKEN; |
| 838 | config.channels.telegram.enabled = true; |
| 839 | config.channels.telegram.dmPolicy = dmPolicy; |
| 840 | // Explicit env override always wins; otherwise only seed allowFrom on |
| 841 | // first boot (when the key is absent) so user edits are preserved. |
| 842 | if (env.TELEGRAM_DM_ALLOW_FROM) { |
| 843 | config.channels.telegram.allowFrom = env.TELEGRAM_DM_ALLOW_FROM.split(','); |
| 844 | } else if (!('allowFrom' in config.channels.telegram)) { |
| 845 | config.channels.telegram.allowFrom = dmPolicy === 'open' ? ['*'] : []; |
| 846 | } |
| 847 | |
| 848 | config.plugins = config.plugins ?? {}; |
| 849 | config.plugins.entries = config.plugins.entries ?? {}; |
| 850 | config.plugins.entries.telegram = config.plugins.entries.telegram ?? {}; |
no test coverage detected