Skip to content

feat(bbb-export-annotations): Add env override for bbb-export-annotations - #26662

Merged
TiagoJacobs merged 6 commits into
bigbluebutton:v4.1.x-developfrom
samuelwei:add-env-for-bbb-export-annotations
Nov 24, 2026
Merged

TiagoJacobs merged 6 commits into
bigbluebutton:v4.1.x-developfrom
samuelwei:add-env-for-bbb-export-annotations

Conversation

@samuelwei

@samuelwei samuelwei commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR adds env support for bbb-export-annotations

  • Environment variables have the highest priority
  • The default value file was renamed to align with the config npm package
  • The override file was moved from /etc/bigbluebutton/bbb-export-annotations.json to /etc/bigbluebutton/bbb-export-annotations/production.json

Note: The pattern used by other packages, e.g. bbb-webrtc-sfu

@antobinary: Mention override file change in release notes

Motivation

Docker setup not needing override files to get the basic setup running

How to test

  • Export slides and check if it works ;)

More

  • Updated documentation

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review: 4

  • v3.0.x-release
  • v3.0.x-develop
  • v4.0.x-release
  • v4.0.x-develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ba1ad94b-b46f-465c-a7ba-ee4bbec605f2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@tibroc

tibroc commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks, this replaces my #26658, which I'm closing. Using config like bbb-webrtc-sfu and bbb-webhooks is the better way, and passing the override file as NODE_CONFIG keeps /etc/bigbluebutton/bbb-export-annotations.json where it is.

A few points from comparing the two:

  1. NODE_CONFIG already set: then the override file is skipped without a message. Maybe log that, or merge both?
  2. A broken override file now fails with a config error about NODE_CONFIG. An error that names /etc/bigbluebutton/bbb-export-annotations.json would help admins.
  3. Names: every key gets the BBB_EXPORT_ANNOTATIONS_ prefix, while bbb-apps-akka, bbb-webhooks and bbb-webrtc-sfu read plain REDIS_HOST. Both are fine with me. If the prefix is the way to go, I'll follow it in feat(shared-notes): read the bbb-web, Redis and PostgreSQL hosts from the environment #26656 (shared-notes) and feat(graphql-middleware): read the service URLs and the Redis host from the environment #26657 (graphql-middleware), which add environment variables the same way.

The compose setup in #26186 will use your variables once this is merged.

@TiagoJacobs

Copy link
Copy Markdown
Member

hello @imdt-claudiop - please review this PR

@antobinary antobinary added this to the Release 4.1 milestone Nov 23, 2026
@imdt-claudiop

Copy link
Copy Markdown
Contributor

Review

Summary. This PR replaces the hand-rolled deep merge in bbb-export-annotations/lib/utils/config.js with the npm config package. It renames config/settings.json to config/default.json, which is the file name that package looks for. It adds a custom-environment-variables.json that maps every setting to a BBB_EXPORT_ANNOTATIONS_* variable. The existing override file /etc/bigbluebutton/bbb-export-annotations.json is still honored: its content is injected through NODE_CONFIG before config is loaded. The precedence becomes defaults < override file < environment, which matches what the PR describes (node-config applies custom-environment-variables last). Importing config dynamically after setting NODE_CONFIG is correct and needed, because a static import would be hoisted and load the config before the variable exists. Worker threads get a copy of process.env when they are created, so they see the same NODE_CONFIG. I found no other place that still points at the old file name: the systemd unit, deploy.sh, build.sh and bigbluebutton-config don't reference it, and the remaining comments are updated in this PR.

Findings

Blocker: a malformed override file no longer stops the service; it silently runs on defaults
bbb-export-annotations/lib/utils/config.js:10-11
Before, JSON.parse on the override threw at startup. The process exited, systemd kept restarting it, and the error was easy to find. Now the raw file content goes into NODE_CONFIG. In config v4.4.2 a malformed NODE_CONFIG is handled like this:

try { envConfig = JSON.parse(process.env.NODE_CONFIG); }
catch(e) { console.error('The $NODE_CONFIG environment variable is malformed JSON'); }

It does not throw: startup continues with only default.json plus the env vars. One missing comma in /etc/bigbluebutton/bbb-export-annotations.json (say, the file that holds redis.password) gives you a running service that ignores the admin's settings. The only trace is a log line that names neither the file nor the position of the error. Suggested fix: parse the file yourself and fail loudly with the path in the message, then hand the parsed object over:

if (fs.existsSync(OVERRIDE_PATH)) {
  let fileOverride;
  try {
    fileOverride = JSON.parse(fs.readFileSync(OVERRIDE_PATH, 'utf8'));
  } catch (e) {
    throw new Error(`Invalid JSON in ${OVERRIDE_PATH}: ${e.message}`);
  }
  // merge with an existing NODE_CONFIG (see point 1 below) and re-serialize
  process.env.NODE_CONFIG = JSON.stringify(fileOverride /* merged */);
}

Suggestion: environment variable names break with the sibling PRs and the other node-config services
bbb-export-annotations/config/custom-environment-variables.json:46 (and every other entry)
bbb-webrtc-sfu and bbb-webhooks map REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, LOG_LEVEL. The two sibling PRs in this effort do the same (#26656 shared-notes and #26657 graphql-middleware both read plain REDIS_HOST). This one would be the only component using BBB_EXPORT_ANNOTATIONS_REDIS_HOST. More on this under tibroc's point 3.

Suggestion: map only what a deployment actually needs to set
bbb-export-annotations/config/custom-environment-variables.json:1-63
Every variable you publish is a public interface the project then has to keep compatible. Settings like log.msgName, notifier.msgName, redis.channels.*, process.maxImageWidth/Height (which the comments in PresPageDAO.scala and SvgImageCreatorImp.java say must stay in sync with akka-apps and bbb-web) and the binary/font paths are internal contracts, not deployment knobs. Exposing them invites drift. A smaller set covers the stated motivation (docker without override files): Redis host/port/password, bbbWebAPI, shared.presAnnDropboxDir, log level, and maybe rasterizeTimeoutSeconds. Anything else can still go in the override file.

Suggestion: NODE_ENV=production will make config log a warning at every startup
build/packages-template/bbb-export-annotations/bbb-export-annotations.service:14, bbb-export-annotations/Dockerfile:20
Both set NODE_ENV=production, and there is no config/production.json. node-config's strictness check then calls console.error with "NODE_ENV value of 'production' did not match any deployment config file names". Each worker thread has its own module graph and loads config again, so this probably repeats for every export job, not only once at boot. I'm inferring that from the package source; check journalctl -u bbb-export-annotations. Options: set SUPPRESS_STRICTNESS_CHECK=1 (or NODE_CONFIG_ENV) where NODE_ENV is set, or ship an empty config/production.json.

Nit: the code comment names a variable that doesn't exist
bbb-export-annotations/lib/utils/config.js:8
BBB_EXPORT_ANNOTATIONS_ENABLED=true is not in the mapping, and the line has an extra ). Use a real one, e.g. BBB_EXPORT_ANNOTATIONS_LOG_LEVEL=debug.

Nit: CAIRO_SVGUNSAFE_FLAG
bbb-export-annotations/config/custom-environment-variables.json:31
The automatic camelCase split lost a word boundary. It should be ..._CAIRO_SVG_UNSAFE_FLAG (or plain CAIRO_SVG_UNSAFE if the prefix goes away).

Nit: env values are parsed strictly and quietly
With __format: "boolean", only the exact string true is true (TRUE, 1 and yes are all false). With __format: "number", a non-numeric value becomes undefined instead of an error. Worth one sentence in the docs so nobody spends an afternoon on CAIRO..._FLAG=1.

On tibroc's three points

  1. NODE_CONFIG already set means the override file is silently skipped. Agreed, and I'd merge rather than only log. In docker someone may well set NODE_CONFIG for a quick tweak while also mounting the file. Dropping the file without a word is the kind of surprise that costs an afternoon. Parse the file (see the blocker), parse any existing NODE_CONFIG, deep-merge them with the explicit NODE_CONFIG winning, and write the result back. If you'd rather keep it simple, at least log a warning naming the skipped file. Either way, one change fixes this point and point 2.

  2. A broken override file now fails with a config error about NODE_CONFIG. It's worse than that: it doesn't fail at all. node-config logs The $NODE_CONFIG environment variable is malformed JSON and carries on with defaults (the blocker above). The fix is to parse the file ourselves and throw an error that names /etc/bigbluebutton/bbb-export-annotations.json.

  3. BBB_EXPORT_ANNOTATIONS_ prefix vs plain REDIS_HOST. I'd drop the prefix, at least for shared infrastructure settings (REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, LOG_LEVEL). Each container, and each systemd unit, has its own environment, so a prefix doesn't protect against collisions there. What it costs is the ability to reuse one Redis env block (an env_file or YAML anchor) across services in #26186. The node-config services this PR says it follows (sfu, webhooks) and both sibling PRs already use plain names. docker/README.md already documents three styles (BBB_REDIS_* in graphql-actions, plain in sfu/webhooks, BBBRECORDER_* in the recorder), so it's worth settling the convention for the series before the three PRs merge with different answers.

On "Updated documentation"

The two doc changes only rename settings.json to default.json (docs/docs/administration/configuration-files.md:39, docs/docs/development/dev-guide.md:430). The feature itself is not documented anywhere:

  • nothing lists the new environment variables or the precedence order (defaults < override file < env);
  • docker/README.md was not touched. It still lists bbb-export-annotations as configured only through the mounted file (line 46), and the "Image contract" section still says **bbb-export-annotations**: none; a deployment mounts /etc/bigbluebutton/bbb-export-annotations.json (lines 124-125). Since docker is the stated motivation, that's the place that most needs the update, in the same shape as the sfu/webhooks entry.

The checkbox should stay unchecked until that is added.

@samuelwei

Copy link
Copy Markdown
Contributor Author

@imdt-claudiop recheck again

@imdt-claudiop

Copy link
Copy Markdown
Contributor

Follow-up review (head b9428c4)

Verdict: almost everything from the first round is addressed. But the new NODE_CONFIG guard introduces a regression that breaks every export on any server that has /etc/bigbluebutton/bbb-export-annotations.json, so this is still a blocker. One small naming question and one leftover nit remain.

New blocker: the NODE_CONFIG guard throws inside every worker thread

bbb-export-annotations/lib/utils/config.js:7-9 together with :21

The main thread validates the override file and then sets process.env.NODE_CONFIG = fileContent (line 21). Exports run in worker_threads (lib/utils/worker-starter.js, new Worker(workerPath, {workerData}), with no env option). By default a worker gets a copy of the parent's process.env taken when the worker is created, so every worker starts with NODE_CONFIG already set. Each worker imports config.js again (workers/collector.js, workers/process.js and workers/notifier.js all do, directly and through logger.js / Shape.js). The guard at line 7 then throws NODE_CONFIG is not allowed to be set via environment variables, the worker exits with an error, and the job fails.

When no override file exists, nothing sets NODE_CONFIG and workers run fine. That is probably why "export slides and check if it works" passed. But the override file is where docs/docs/administration/configuration-files.md tells admins to put redis.password, so every server with a Redis password or any other local setting would lose exports. This is from reading the code; please confirm by creating the override file and exporting once.

Possible fixes, smallest first:

  • run the guard only in the main thread: import {isMainThread} from 'worker_threads'; and if (isMainThread && process.env.NODE_CONFIG) { throw ... };
  • or remember that we set it ourselves (e.g. compare against the file content, or set a private marker variable) and skip the throw in that case.

Either way, a test that runs one worker with the override file present would catch this class of bug.

Status of the first-round findings

Finding Status
Blocker: malformed override silently ignored Fixed. config.js:16-25 parses the file before handing it to config and throws Invalid JSON in /etc/bigbluebutton/bbb-export-annotations.json: <reason>, so it fails loudly and names the file.
tibroc's point 1: existing NODE_CONFIG silently skips the file Addressed by forbidding it (config.js:5-9). Rejecting a pre-set NODE_CONFIG is a fine answer, simpler than merging, but as written it breaks the workers (new blocker above).
Env set too wide Fixed. config/custom-environment-variables.json now maps only log.level, the shared.* paths, process.rasterizeTimeoutSeconds, bbbWebAPI and redis.host/port/password. That covers the docker motivation: Redis host/port/password, the bbb-web URL, the dropbox dir and the log level. Nothing needed was dropped; the paths in sync with akka-apps/bbb-web, the channels and the message names are no longer exposed.
NODE_ENV=production strictness warning Fixed. config/production.json ({}) is a deployment file that matches production, so the check finds a file and stays quiet. Workers load the same directory, so they are covered too. It is not excluded by .dockerignore or .build-files, so it ships in the image and in the .deb. Nit: no trailing newline.
Naming convention (tibroc's point 3) Resolved: shared settings are unprefixed (REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, BBB_WEB_HOST), component settings keep BBB_EXPORT_ANNOTATIONS_*. That matches sfu/webhooks and the sibling PRs. One follow-up on BBB_WEB_HOST below.
docker/README.md not updated Fixed (table row and image contract section), in the same shape as the sfu/webhooks entry.
Nit: CAIRO_SVGUNSAFE_FLAG Gone, the key is no longer mapped.
Nit: strict boolean/number parsing Mostly moot: no boolean is mapped anymore. The two numbers (REDIS_PORT, ..._RASTERIZE_TIMEOUT_SECONDS) still turn a non-numeric value into undefined quietly; optional half sentence in the README.
Nit: code comment names a variable that doesn't exist Still open. config.js:14 now gives BBB_EXPORT_ANNOTATIONS_BBB_WEB_API=https://example.com as the example, which is not mapped (the variable is BBB_WEB_HOST), and the )) is still there.

New suggestions

BBB_WEB_HOST holds a URL here but a bare host in shared-notes
bbb-export-annotations/config/custom-environment-variables.json:18

Here BBB_WEB_HOST maps to bbbWebAPI, a full URL (the README example is http://web:8090). In #26656, shared-notes reads the same name into config.bbbWeb.host, a bare host with the port kept separately (port: 8090). A compose file that shares one value between the two services breaks one of them: web gives this component no scheme or port, and http://web:8090 gives shared-notes an invalid host. Either rename this one (e.g. BBB_WEB_URL) or align both PRs on one shape. Since the point of the plain names is sharing them across containers, the same name should mean the same thing.

Nit: the catch block reports every error as invalid JSON
bbb-export-annotations/lib/utils/config.js:18-23

readFileSync sits inside the same try, so a permission error (EACCES, e.g. the file is root:root 0600 and the service runs as bigbluebutton) becomes Invalid JSON in ...: EACCES .... The path is right but the label sends the admin to look for a syntax error. Moving the read out of the try, or using Cannot read ${OVERRIDE_PATH} for read errors, fixes it.

Optional: mention the NODE_CONFIG restriction
Now that a pre-set NODE_CONFIG makes the service refuse to start, a line in the export-annotations entry of docker/README.md saves someone a confused restart loop.

@samuelwei
samuelwei force-pushed the add-env-for-bbb-export-annotations branch from b9428c4 to f67546c Compare November 23, 2026 17:51
@samuelwei

Copy link
Copy Markdown
Contributor Author

@imdt-claudiop recheck again

@imdt-claudiop

Copy link
Copy Markdown
Contributor

Follow-up review (head f67546c)

Verdict: the worker-thread blocker is fixed and nothing blocks merge anymore. The fix brings back the silent skip of the override file when NODE_CONFIG comes from outside (tibroc's point 1). One nit and one suggestion from the last round are still open. The only file changed since b9428c4 is lib/utils/config.js.

Status

Blocker: worker threads threw on the inherited NODE_CONFIG. Fixed.
bbb-export-annotations/lib/utils/config.js:10
The throwing guard is gone, and the block is now if (!process.env.NODE_CONFIG && fs.existsSync(OVERRIDE_PATH)). Traced again: the main thread validates the file and sets NODE_CONFIG (:13-15). worker-starter.js creates workers without an env option, so each worker gets a copy of process.env with that value. In the worker the condition is false, the file is not read again, and config loads the same JSON from the inherited NODE_CONFIG (:21). Workers see the same merged config as the main thread, and the file is parsed and validated once, in the main thread.

Malformed override file fails loudly with its path. Still fixed.
bbb-export-annotations/lib/utils/config.js:12-18

tibroc's point 1: an existing NODE_CONFIG silently skips the override file. Back to the original behavior.
bbb-export-annotations/lib/utils/config.js:10
Removing the throw was the right call for the workers. But the condition can't tell "the main thread set this" from "the operator set this". So a NODE_CONFIG exported in a compose file or a systemd drop-in again means the mounted /etc/bigbluebutton/bbb-export-annotations.json is ignored without a word. In that path a malformed NODE_CONFIG is also only reported by config's console.error and the service runs on defaults. That's opt-in and less likely than a broken file, so I'd call it a suggestion, not a blocker. A cheap way to cover it without touching the worker path:

import {isMainThread} from 'worker_threads';

if (isMainThread && process.env.NODE_CONFIG && fs.existsSync(OVERRIDE_PATH)) {
  console.warn(`NODE_CONFIG is set; ignoring ${OVERRIDE_PATH}`);
}

Or merge the two in the main thread, with NODE_CONFIG winning. Either way, one line in the export-annotations entry of docker/README.md would document the behavior.

Nit: comment example names an unmapped variable, with a stray )). Still open.
bbb-export-annotations/lib/utils/config.js:8
BBB_EXPORT_ANNOTATIONS_BBB_WEB_API is not in custom-environment-variables.json, which maps bbbWebAPI to BBB_WEB_HOST. Suggest BBB_WEB_HOST=http://web:8090, which matches the README, with a single ).

Nit: every error in the catch is labeled "Invalid JSON". Still open.
bbb-export-annotations/lib/utils/config.js:12-17
readFileSync is still inside the try, so a permission problem on the file (EACCES when the service user bigbluebutton can't read it) is reported as Invalid JSON in /etc/bigbluebutton/bbb-export-annotations.json: EACCES.... Moving the read above the try makes the message say what actually went wrong.

Suggestion: BBB_WEB_HOST is a URL here and a bare host in #26656. No change, and no reply that I could find.
bbb-export-annotations/config/custom-environment-variables.json:18
Here the variable feeds bbbWebAPI (http://web:8090). In shared-notes (#26656) the same name feeds bbbWeb.host, with the port kept separately. One shared value in a compose file can't satisfy both. Either rename this one (e.g. BBB_WEB_URL) or align the two PRs, so the shared names mean the same thing everywhere. If the plan is to settle this across the series later, a short reply saying so would close the thread.

Unchanged and still fine: the smaller env set (custom-environment-variables.json), config/production.json silencing the NODE_ENV warning in the main thread and in workers (nit: no trailing newline), and the docker/README.md entries.

New findings

None beyond the return of point 1 described above.

@antobinary antobinary changed the title Add env override for bbb-export-annotations feat(bbb-export-annotation): Add env override for bbb-export-annotations Nov 23, 2026
@samuelwei
samuelwei force-pushed the add-env-for-bbb-export-annotations branch from f67546c to eb0662e Compare November 24, 2026 12:02
@samuelwei

Copy link
Copy Markdown
Contributor Author

@imdt-claudiop recheck again

@imdt-claudiop

Copy link
Copy Markdown
Contributor

Follow-up review (head 3b4cb62)

Verdict: the redesign (two-entry NODE_CONFIG_DIR, no hand-written loading code) settles every earlier finding, and nothing blocks merge. The main thing left is the upgrade path for servers that already have /etc/bigbluebutton/bbb-export-annotations.json. There are also two smaller points about directory order and the new comment.

Earlier findings

Finding Status
Malformed override silently ignored Fixed by design. config reads the override as a regular file and throws Cannot parse config file: '<path>': ... on invalid content.
EACCES labeled "Invalid JSON" Fixed by design. An unreadable file now fails with Config file <path> cannot be read. Error code is: EACCES.
tibroc's point 1, existing NODE_CONFIG skips the file Moot. The code no longer injects anything through NODE_CONFIG; an operator-set NODE_CONFIG just merges on top of the files, which is standard node-config behavior.
Worker threads and NODE_CONFIG Sound. lib/utils/config.js:1-6 is now a plain import config from 'config'. Workers inherit NODE_ENV and NODE_CONFIG_DIR from the process environment and load the same files as the main thread, with no special case.
Comment example naming an unmapped variable, stray ) Gone, the comment was rewritten (see the nit below).
BBB_WEB_HOST URL vs bare host in #26656 Fixed. Renamed to BBB_WEB_API (config/custom-environment-variables.json:18), matching the config key and its URL shape. docker/README.md follows.
NODE_ENV=production warning Still fine. production.json now exists in both directories.

New scope

Suggestion: upgrading servers lose their override with no warning from the service
build/packages-template/bbb-export-annotations/after-install.sh, bigbluebutton-config/bin/bbb-conf:852-857

After the package upgrade, /etc/bigbluebutton/bbb-export-annotations.json is ignored. The docs tell admins to put redis.password exactly there (configuration-files.md, the Redis password table). On a server with requirepass, the service then runs without the password and fails on its first Redis command, in a restart loop whose log doesn't point at the moved file.

The bbb-conf check itself is correct. It runs in check_configuration, reached from check_state (bbb-conf --check). It fires only while the old file exists, which is exactly when that file is being ignored, so there are no false positives; it also correctly keeps warning when both files exist. The weakness is reach: it only helps admins who run --check. Two cheap ways to close the gap, either one is enough:

  • in after-install.sh: if the old file exists and the new one doesn't, mkdir -p /etc/bigbluebutton/bbb-export-annotations and move (or copy) it, then print a line saying so;
  • or have the service log a warning at startup when the old path exists, so the hint lands in journalctl -u bbb-export-annotations, next to the failure.

The release-notes mention in docs/docs/new-features.md is good and should stay either way.

Suggestion: list the /etc directory last in NODE_CONFIG_DIR
build/packages-template/bbb-export-annotations/bbb-export-annotations.service:15, bbb-export-annotations/Dockerfile:20-21, bbb-export-annotations/run-dev.sh:19-21

config sorts the files it finds by base name (default, then production, then local...). Reading locateMatchingFiles, files with the same name keep the order the directories have in NODE_CONFIG_DIR, and later files win the merge. With /etc/...:/usr/local/.../config/, the shipped config/production.json is merged after the admin's /etc/.../production.json. Today that is harmless only because the shipped file is {}; the day someone puts a key in it, that key silently beats the admin's override. Putting the app directory first (/usr/local/bigbluebutton/bbb-export-annotations/config/:/etc/bigbluebutton/bbb-export-annotations/) makes the admin file win by construction. Worth a quick test with a temporary key in the shipped file to confirm.

Suggestion: an unreadable /etc directory is skipped silently
config lists each directory inside a try with an empty catch. A missing directory being skipped is what we want, because a fresh install has no override. But a directory the bigbluebutton user can't list (say an admin creates it 0700 root to protect the Redis password) is skipped the same way: the service runs on defaults with no message. An unreadable file does fail loudly, so the gap is only the directory. A short permissions note in configuration-files.md (directory 0755, file readable by bigbluebutton) covers it.

Nit: the new comment overstates what is read
bbb-export-annotations/lib/utils/config.js:1-3
NODE_CONFIG_DIR doesn't limit loading to default.json and the /etc override. config also reads config/production.json, custom-environment-variables.json, and any local*, <hostname>* or other supported extension (.yml, .json5, .js...) in both directories. Something like "settings come from default.json, the production.* files in both directories of NODE_CONFIG_DIR, then the env vars mapped in custom-environment-variables.json" would be accurate.

Docs

  • docker/README.md: the env variables, the new path and the precedence (env over the mounted file) are documented, in the same shape as sfu/webhooks. Matches the code.
  • docs/docs/administration/configuration-files.md:39 and the Redis password table: both now point at the new path. Nit: the struck-through old path inside a table cell is hard to read. The new path plus "(was /etc/bigbluebutton/bbb-export-annotations.json before 4.1)" says the same thing more plainly.
  • docs/docs/new-features.md: the move is called out for the 4.1 notes.
  • The env variables are documented only in docker/README.md. That fits the docker motivation; for bare metal, the /etc file stays the documented way, which is fine.

Nits

  • PR title: feat(bbb-export-annotation) is missing the s of the component name.
  • config/production.json still has no trailing newline.

samuelwei and others added 4 commits November 24, 2026 15:02
Replace the hand-written loader with node-config, configured like
bbb-webrtc-sfu:

- config/settings.json becomes config/default.json
- the override is /etc/bigbluebutton/bbb-export-annotations/production.json,
  found through NODE_CONFIG_DIR, which the systemd unit, the Dockerfile and
  run-dev.sh set
- environment variables listed in config/custom-environment-variables.json
  (REDIS_*, BBB_WEB_API and a few BBB_EXPORT_ANNOTATIONS_* settings) take
  precedence over both files
- nothing sets NODE_CONFIG, so the master and its workers resolve the same
  settings
- an empty config/production.json silences node-config's warning when no
  override exists

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
/etc/bigbluebutton/bbb-export-annotations.json is no longer read; the
override now lives in /etc/bigbluebutton/bbb-export-annotations/production.json.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
If /etc/bigbluebutton/bbb-export-annotations.json exists and the new
/etc/bigbluebutton/bbb-export-annotations/production.json does not, after-install.sh
moves it, so settings such as the Redis password survive the upgrade.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@samuelwei
samuelwei force-pushed the add-env-for-bbb-export-annotations branch from 3b4cb62 to bf07013 Compare November 24, 2026 14:17
@samuelwei samuelwei changed the title feat(bbb-export-annotation): Add env override for bbb-export-annotations feat(bbb-export-annotations): Add env override for bbb-export-annotations Nov 24, 2026
@samuelwei

Copy link
Copy Markdown
Contributor Author

@imdt-claudiop recheck again

@imdt-claudiop

Copy link
Copy Markdown
Contributor

Follow-up review (head bf07013)

Verdict: every point from the last round is addressed and the upgrade path is now covered; nothing blocks merge. One suggestion on the migration (ownership) and two small wording nits remain.

New: migration on package upgrade

build/packages-template/bbb-export-annotations/after-install.sh:8-16

This works and is in the right place:

  • It runs on configure, before the service is started again further down the script, so the restarted service already reads the moved file.
  • It only acts when the old file exists and the new path doesn't (:11). A fresh install, or a server that already has production.json, is left alone.
  • mkdir -p under root's default umask creates the directory as 0755, which matches the new note in the docs. mv keeps the file's mode.
  • It prints Moved ... to ... (:15), so the admin sees it in the upgrade output.
  • With bash -e, a failing mkdir, mv or chown would abort the postinst and leave the package half-configured. On a real upgrade none of them should fail (same filesystem, and the bigbluebutton user already exists), so I don't see a practical failure mode.

Suggestion: drop the chown (:14) and keep the file's original owner. The old file was readable by the service before the move, and mv keeps owner and mode, so the chown isn't needed for things to work. What it does change is that the service user can now write its own config. That file holds redis.password and the paths of binaries the service executes (shared.cairosvg, shared.ghostscript, shared.pdftocairo), so a compromised export process could rewrite which binary it runs on the next restart. Config under /etc is normally owned by root. If the intent is to protect the password, chown root:bigbluebutton plus chmod 0640 does that without giving the service write access.

Nit: say something when the migration is skipped. If both files exist, nothing is printed and the old file stays. bbb-conf --check will catch it later, but one echo in an elif [ -f $OLD_OVERRIDE ] branch ("both exist; merge ... into ... and remove the old file") puts the hint in the upgrade output, where the admin is looking.

Last round's items

Item Status
NODE_CONFIG_DIR order (/etc must come last so the admin file wins) Fixed in all three places: bbb-export-annotations.service:15, Dockerfile:20-21, run-dev.sh:21.
Unreadable /etc directory skipped silently Addressed in the docs: the new paragraph after the Redis password table in configuration-files.md says the directory must be 0755 and the file readable by bigbluebutton, or the override is skipped without a message.
Overstated comment Fixed. lib/utils/config.js:1-3 now says default.json, the production.json files in both directories (/etc last), then the mapped env vars. That is accurate for everything this component ships.
production.json trailing newline Fixed.
Struck-through old path in the docs table Fixed: configuration-files.md:39 reads .../production.json (was /etc/bigbluebutton/bbb-export-annotations.json before 4.1).
PR title Fixed.

bbb-conf and docs

  • bigbluebutton-config/bin/bbb-conf:852-857: unchanged. Still correct. Nit: after this PR the old file only survives the upgrade when the new one already existed, so "Move it to ..." will usually find a target that is already there. "Merge it into /etc/bigbluebutton/bbb-export-annotations/production.json and remove it" fits that case better.
  • docker/README.md, configuration-files.md (both tables plus the permissions note) and new-features.md: consistent with the code. Optional: the new-features.md entry could add that the package moves the file automatically on upgrade, so admins know they only need to act when both files exist.

New findings

None besides the chown suggestion above.

mv keeps the owner and mode, so the service can still read the file. The
chown made it writable by the service user, which could then change the
binaries it executes (shared.cairosvg and others) or the Redis password.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@TiagoJacobs

Copy link
Copy Markdown
Member

merging, considering I'll do a follow-up PR with a small fix tonight

@TiagoJacobs
TiagoJacobs merged commit b26dba2 into bigbluebutton:v4.1.x-develop Nov 24, 2026
54 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants