mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-28 06:51:16 +08:00
fix(gateway): respect config.yaml slack.enabled when SLACK_BOT_TOKEN env var is set
Previously, setting SLACK_BOT_TOKEN in .env would unconditionally enable the Slack gateway adapter regardless of `slack.enabled: false` in config.yaml. This caused spurious "SLACK_APP_TOKEN not set" errors when the token was used only by skills (e.g. cron jobs that send Slack messages) rather than for the Hermes messaging gateway. Now, enabled: false in config.yaml is respected — the token is stored so skills can still use it, but the gateway adapter is not activated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -934,8 +934,12 @@ def _apply_env_overrides(config: GatewayConfig) -> None:
|
|||||||
slack_token = os.getenv("SLACK_BOT_TOKEN")
|
slack_token = os.getenv("SLACK_BOT_TOKEN")
|
||||||
if slack_token:
|
if slack_token:
|
||||||
if Platform.SLACK not in config.platforms:
|
if Platform.SLACK not in config.platforms:
|
||||||
|
# No yaml config for Slack — env-only setup, enable it
|
||||||
config.platforms[Platform.SLACK] = PlatformConfig()
|
config.platforms[Platform.SLACK] = PlatformConfig()
|
||||||
config.platforms[Platform.SLACK].enabled = True
|
config.platforms[Platform.SLACK].enabled = True
|
||||||
|
# If yaml config exists, respect its enabled flag (don't override
|
||||||
|
# explicit enabled: false). Token is still stored so skills that
|
||||||
|
# send Slack messages can use it without activating the gateway adapter.
|
||||||
config.platforms[Platform.SLACK].token = slack_token
|
config.platforms[Platform.SLACK].token = slack_token
|
||||||
slack_home = os.getenv("SLACK_HOME_CHANNEL")
|
slack_home = os.getenv("SLACK_HOME_CHANNEL")
|
||||||
if slack_home and Platform.SLACK in config.platforms:
|
if slack_home and Platform.SLACK in config.platforms:
|
||||||
|
|||||||
Reference in New Issue
Block a user