Files
bare-operating-system/packages/bare-os-protocol/lib/chat-env.js
T
2026-04-21 20:05:57 -04:00

15 lines
631 B
JavaScript

/**
* Swarm chat Protomux pairing is **enabled by default** (stock builds).
* Opt out with **`BARE_OS_PROTOMUX_CHAT_CHANNEL=0`**, **`false`**, **`off`**, or **`no`** (case-insensitive trim).
* @param {Record<string, string | undefined> | null | undefined} env
*/
export function bareOsProtMuxChatChannelEnabled(env) {
if (!env || typeof env !== 'object') return true
const v = env.BARE_OS_PROTOMUX_CHAT_CHANNEL
if (v === undefined || v === null) return true
const s = String(v).trim().toLowerCase()
if (s === '') return true
if (s === '0' || s === 'false' || s === 'off' || s === 'no') return false
return true
}