Files
agent-news/bot/lib/config.dart
matt2dev be09de2ad7 Initial agent-news: Dart Telegram bot + Claude Code runner + MCP bridge
/news spawns claude-code as a local subprocess (single pod, no cross-container
exec on K3s); Claude delivers the digest itself via the send_to_telegram MCP tool.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-21 20:40:32 +03:00

41 lines
1.4 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'dart:io';
class Config {
final String telegramToken;
final Set<int> allowedChatIds;
final String newsPrompt;
final int claudeTimeoutSeconds;
final String mcpConfigPath;
Config({
required this.telegramToken,
required this.allowedChatIds,
required this.newsPrompt,
required this.claudeTimeoutSeconds,
required this.mcpConfigPath,
});
factory Config.fromEnv() {
final e = Platform.environment;
final allowed = (e['ALLOWED_CHAT_IDS'] ?? '')
.split(',')
.map((s) => s.trim())
.where((s) => s.isNotEmpty)
.map(int.parse)
.toSet();
return Config(
telegramToken: e['TELEGRAM_BOT_TOKEN'] ?? '',
allowedChatIds: allowed,
newsPrompt: e['NEWS_PROMPT'] ??
'Проведи ресёрч последних новостей и трендов в области искусственного '
'интеллекта за последние 7 дней. Используй поиск в интернете. '
'Составь краткую выжимку: 5-8 пунктов, у каждого — суть в 1-2 '
'предложениях и ссылка на источник.',
claudeTimeoutSeconds:
int.tryParse(e['CLAUDE_TIMEOUT_SECONDS'] ?? '360') ?? 360,
mcpConfigPath: e['MCP_CONFIG_PATH'] ?? '/home/agent/claude-config/mcp.json',
);
}
}