From 1b1ca2214a0fd499b8ddd75fe34d59b91e0ff63d Mon Sep 17 00:00:00 2001 From: hi <113666764+thinhfromtop@users.noreply.github.com> Date: Sat, 28 Feb 2026 09:14:36 +0700 Subject: [PATCH] feat(discord): support GOCLAW_DISCORD_TOKEN env var for channel config (#6) Add env var overlay and auto-enable for Discord channel, matching the existing Telegram pattern. Update .env.example and docker-compose.yml. Co-authored-by: Claude Opus 4.6 --- .env.example | 1 + docker-compose.yml | 1 + internal/config/config_load.go | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/.env.example b/.env.example index bbfb191e..43d03e0e 100644 --- a/.env.example +++ b/.env.example @@ -17,6 +17,7 @@ GOCLAW_ENCRYPTION_KEY= # --- Channels (optional) --- GOCLAW_TELEGRAM_TOKEN= +GOCLAW_DISCORD_TOKEN= # --- Database (only for non-Docker deployments) --- # Docker Compose auto-builds this from POSTGRES_USER/PASSWORD/DB. diff --git a/docker-compose.yml b/docker-compose.yml index 5bf32cd7..29e60f35 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,6 +42,7 @@ services: - GOCLAW_XAI_API_KEY=${GOCLAW_XAI_API_KEY:-} # Channels - GOCLAW_TELEGRAM_TOKEN=${GOCLAW_TELEGRAM_TOKEN:-} + - GOCLAW_DISCORD_TOKEN=${GOCLAW_DISCORD_TOKEN:-} # Debug - GOCLAW_TRACE_VERBOSE=${GOCLAW_TRACE_VERBOSE:-0} volumes: diff --git a/internal/config/config_load.go b/internal/config/config_load.go index 84bd94ef..c3bf0416 100644 --- a/internal/config/config_load.go +++ b/internal/config/config_load.go @@ -106,6 +106,7 @@ func (c *Config) applyEnvOverrides() { envStr("GOCLAW_PERPLEXITY_API_KEY", &c.Providers.Perplexity.APIKey) envStr("GOCLAW_GATEWAY_TOKEN", &c.Gateway.Token) envStr("GOCLAW_TELEGRAM_TOKEN", &c.Channels.Telegram.Token) + envStr("GOCLAW_DISCORD_TOKEN", &c.Channels.Discord.Token) envStr("GOCLAW_ZALO_TOKEN", &c.Channels.Zalo.Token) envStr("GOCLAW_FEISHU_APP_ID", &c.Channels.Feishu.AppID) envStr("GOCLAW_FEISHU_APP_SECRET", &c.Channels.Feishu.AppSecret) @@ -122,6 +123,9 @@ func (c *Config) applyEnvOverrides() { if c.Channels.Telegram.Token != "" { c.Channels.Telegram.Enabled = true } + if c.Channels.Discord.Token != "" { + c.Channels.Discord.Enabled = true + } if c.Channels.Zalo.Token != "" { c.Channels.Zalo.Enabled = true }