Skip to content
This repository was archived by the owner on Oct 9, 2026. It is now read-only.

feat: environment variables turn a channel and its streaming on - #49

Closed
mekjr1 wants to merge 1 commit into
mainfrom
feat/web-channel-env
Closed

mekjr1 wants to merge 1 commit into
mainfrom
feat/web-channel-env

Conversation

@mekjr1

@mekjr1 mekjr1 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #43.

A program that starts compa-kernel gateway could set the web chat's token with COMPA_CHANNELS_WEB_TOKEN, but no variable turned the channel on. So it had to write channel_list.web into config.json. Because a file entry replaces the default one whole, it also had to write streaming and the rest, and keep them in step with Compa's defaults.

Now:

  • COMPA_CHANNELS_<NAME>_ENABLED sets a channel_list entry's enabled. <NAME> is the entry's name in capitals, with _ for each character other than a letter or digit, so COMPA_CHANNELS_WEB_ENABLED=true turns on the default web entry, streaming included.
    • It's read in initChannelList, next to the settings' env tags, so it applies to every entry, the defaults included.
    • A value that isn't a boolean fails the load, naming the variable and the channel, as a bad env-tag value does. An empty value counts as unset.
  • COMPA_CHANNELS_WEB_STREAMING_ENABLED, _THROTTLE_SECONDS and _MIN_GROWTH_CHARS set the web chat's streaming. They work like Telegram's existing variables, which now share their code (applyStreamingEnvOverrides).
  • Both are recorded as environment overrides, so SaveConfig writes the file's value back, as for the other variables.

docs/cli.md lists the variables. It also says that saving keeps a file's value for a setting a variable set, unless you change the setting. CHANGELOG line under Added.

Tests:

  • TestChannelEnabledEnvOverride loads a config with the variables set. It checks that web turns on, Telegram turns off and web streaming turns off. After SaveConfig, the file keeps its own values for all three.
  • That test fails when the variable isn't applied, when the override isn't recorded (for either channel), and without the web streaming variable.
  • TestChannelEnabledEnvOverrideRejectsABadValue and TestChannelEnabledEnvName cover a bad value and the name mapping.

@mekjr1

mekjr1 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #63, which includes this change or replaces it.

@mekjr1 mekjr1 closed this Oct 9, 2026
@mekjr1
mekjr1 deleted the feat/web-channel-env branch October 9, 2026 03:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let an environment variable turn on the web chat channel

1 participant