LemonCore. Config. Gateway
(lemon_core v0.1.0)
View Source
Gateway configuration for Telegram, SMS, and engine management.
Inspired by Ironclaw's modular config pattern, this module handles gateway-specific configuration including Telegram bot settings, SMS configuration, engine bindings, and queue management.
Configuration
Configuration is loaded from the TOML config file under [gateway]:
[gateway]
max_concurrent_runs = 2
default_engine = "lemon"
default_cwd = "~/workspace"
auto_resume = false
enable_telegram = true
enable_discord = false
enable_xmtp = false
enable_webhook = false
require_engine_lock = true
engine_lock_timeout_ms = 60000
[[gateway.bindings]]
transport = "telegram"
chat_id = 123456789
agent_id = "default"
[gateway.telegram]
bot_token_secret = "telegram_bot_token"
[gateway.telegram.compaction]
enabled = true
context_window_tokens = 400000
reserve_tokens = 16384
trigger_ratio = 0.9Environment variables override file configuration:
LEMON_GATEWAY_MAX_CONCURRENT_RUNSLEMON_GATEWAY_DEFAULT_ENGINELEMON_GATEWAY_DEFAULT_CWDLEMON_GATEWAY_ENABLE_TELEGRAMLEMON_GATEWAY_REQUIRE_ENGINE_LOCKLEMON_GATEWAY_ENGINE_LOCK_TIMEOUT_MS
Summary
Functions
Returns the default gateway configuration as a map.
Resolves gateway configuration from settings and environment variables.
Types
@type t() :: %LemonCore.Config.Gateway{ auto_resume: boolean(), bindings: [binding()], default_cwd: String.t() | nil, default_engine: String.t(), discord: map(), email: map(), enable_discord: boolean(), enable_telegram: boolean(), enable_webhook: boolean(), enable_xmtp: boolean(), engine_lock_timeout_ms: integer(), engines: map(), max_concurrent_runs: integer(), projects: map(), queue: queue_config(), require_engine_lock: boolean(), sms: map(), telegram: telegram_config(), voice: voice_config(), webhook: map(), xmtp: map() }
@type telegram_config() :: %{ token: String.t() | nil, bot_token_secret: String.t() | nil, default_account_id: String.t() | nil, default_chat_id: String.t() | integer() | nil, default_thread_id: String.t() | integer() | nil, default_topic_id: String.t() | integer() | nil, compaction: telegram_compaction() }
@type voice_config() :: %{ enabled: boolean() | nil, twilio_account_sid: String.t() | nil, twilio_account_sid_secret: String.t() | nil, twilio_auth_token: String.t() | nil, twilio_auth_token_secret: String.t() | nil, twilio_phone_number: String.t() | nil, deepgram_api_key: String.t() | nil, deepgram_api_key_secret: String.t() | nil, elevenlabs_api_key: String.t() | nil, elevenlabs_api_key_secret: String.t() | nil, elevenlabs_voice_id: String.t() | nil, elevenlabs_output_format: String.t() | nil, websocket_port: integer() | nil, public_url: String.t() | nil, llm_model: String.t() | nil, system_prompt: String.t() | nil, max_call_duration_seconds: integer() | nil, silence_timeout_ms: integer() | nil }
Functions
@spec defaults() :: map()
Returns the default gateway configuration as a map.
This is used as the base configuration that gets overridden by user settings.
Resolves gateway configuration from settings and environment variables.
Priority: environment variables > TOML config > defaults