Skip to content

docs: env: bash-style default value operator :-#2568

Open
benjaminmueggenburg-serato wants to merge 1 commit intofluent:masterfrom
benjaminmueggenburg-serato:master
Open

docs: env: bash-style default value operator :-#2568
benjaminmueggenburg-serato wants to merge 1 commit intofluent:masterfrom
benjaminmueggenburg-serato:master

Conversation

@benjaminmueggenburg-serato
Copy link
Copy Markdown

@benjaminmueggenburg-serato benjaminmueggenburg-serato commented May 8, 2026

Summary by CodeRabbit

  • Documentation
    • Updated Fluent Bit environment variable configuration documentation with explicit syntax examples for variable substitution formats (standard and with default value fallback)
    • Added new sections detailing fallback behavior when environment variables are unset or empty
    • Included practical examples demonstrating default value usage

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates Fluent Bit documentation to clarify environment variable substitution. Two files are enhanced with explicit syntax documentation for standard variable references and default-value fallback syntax, alongside a new subsection explaining when defaults apply.

Changes

Environment Variable Substitution Documentation

Layer / File(s) Summary
Variable Substitution Syntax
administration/configuring-fluent-bit/classic-mode/variables.md, administration/configuring-fluent-bit/yaml/environment-variables-section.md
Documents both ${MY_VARIABLE} and ${MY_VARIABLE:-default_value} syntax formats. Classic-mode section explicitly defines supported interpolation forms; YAML section adds "Default Values" section with example of service.flush defaulting to 5 when FLUSH_INTERVAL is unset.
Fallback Behavior & Implementation Details
administration/configuring-fluent-bit/classic-mode/variables.md
Restructures previous documentation with new structured format list; introduces "Fallback Behavior" subsection specifying that ${VARIABLE:-DEFAULT} resolves to DEFAULT when variable is unset or empty string; retains configuration parsing behavior description.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A rabbit hops through docs with glee,
Variables now have clarity!
With defaults set, both old and new,
No more confusion—the syntax shines through!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: documentation updates explaining the bash-style default value operator :- for environment variables in Fluent Bit configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: benjaminmueggenburg-serato <benjamin.mueggenburg@serato.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
administration/configuring-fluent-bit/classic-mode/variables.md (2)

22-26: 💤 Low value

Minor terminology clarification.

The phrase "primary variable" at line 23 could be simplified to just "the variable" for clarity. The word "primary" doesn't add meaningful distinction here since there's only one variable being evaluated.

📝 Proposed simplification
-If the `${VARIABLE:-DEFAULT}` syntax is used, Fluent Bit will use the `DEFAULT` value if the primary variable meets either of the following conditions:
+If the `${VARIABLE:-DEFAULT}` syntax is used, Fluent Bit will use the `DEFAULT` value if the variable meets either of the following conditions:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@administration/configuring-fluent-bit/classic-mode/variables.md` around lines
22 - 26, Replace the phrase "primary variable" with "the variable" in the
"Fallback Behavior" section describing the `${VARIABLE:-DEFAULT}` syntax so the
bullet points read that Fluent Bit will use the `DEFAULT` value if the variable
is not defined (unset) or is defined but set to an empty string; update the
sentence containing "primary variable" under the "Fallback Behavior" heading to
use "the variable" for clarity.

17-17: 💤 Low value

Grammar: Use hyphen to join compound modifier.

"Debian based system" should be "Debian-based system" when used as a compound adjective before a noun.

📝 Proposed fix
-- `/etc/default/fluent-bit` (Debian based system)
+- `/etc/default/fluent-bit` (Debian-based system)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@administration/configuring-fluent-bit/classic-mode/variables.md` at line 17,
The phrase "/etc/default/fluent-bit (Debian based system)" uses "Debian based"
as a compound modifier; update that text to read "/etc/default/fluent-bit
(Debian-based system)" so the compound adjective is hyphenated correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@administration/configuring-fluent-bit/yaml/environment-variables-section.md`:
- Around line 68-79: The "Default Values" section currently says defaults apply
only "if the variable is not defined"; update the text to state that the
`${VARIABLE_NAME:-DEFAULT_VALUE}` syntax supplies the DEFAULT_VALUE both when
the variable is unset and when it is defined but set to an empty string, so the
behavior matches the classic-mode doc; adjust the explanatory sentence and any
examples (the `service.flush: ${FLUSH_INTERVAL:-5}` example) to reflect this
dual-case behavior and ensure wording mirrors the classic-mode variables.md
description.

---

Nitpick comments:
In `@administration/configuring-fluent-bit/classic-mode/variables.md`:
- Around line 22-26: Replace the phrase "primary variable" with "the variable"
in the "Fallback Behavior" section describing the `${VARIABLE:-DEFAULT}` syntax
so the bullet points read that Fluent Bit will use the `DEFAULT` value if the
variable is not defined (unset) or is defined but set to an empty string; update
the sentence containing "primary variable" under the "Fallback Behavior" heading
to use "the variable" for clarity.
- Line 17: The phrase "/etc/default/fluent-bit (Debian based system)" uses
"Debian based" as a compound modifier; update that text to read
"/etc/default/fluent-bit (Debian-based system)" so the compound adjective is
hyphenated correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0131c310-bdb3-4583-bef3-ac293feb8a38

📥 Commits

Reviewing files that changed from the base of the PR and between 61734b0 and 032baeb.

📒 Files selected for processing (2)
  • administration/configuring-fluent-bit/classic-mode/variables.md
  • administration/configuring-fluent-bit/yaml/environment-variables-section.md

Comment on lines +68 to +79
## Default Values

Fluent Bit supports setting a default value for an environment variable if the variable is not defined. This is useful for providing a fallback when an external or configuration-level variable might be missing.

The syntax for a default value is `${VARIABLE_NAME:-DEFAULT_VALUE}`.

```yaml
service:
flush: ${FLUSH_INTERVAL:-5}
log_level: info
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for how Fluent Bit implements the :- operator to confirm behavior
rg -nP -C5 ':-' --type=c --type=cpp -g '!*test*' -g '!*example*'

Repository: fluent/fluent-bit-docs

Length of output: 215


🏁 Script executed:

# First, find the file mentioned in the review
find . -name "variables.md" -type f | head -20

Repository: fluent/fluent-bit-docs

Length of output: 132


🏁 Script executed:

# List files in the classic-mode directory to understand structure
find . -path "*classic-mode*" -type f | head -20

Repository: fluent/fluent-bit-docs

Length of output: 543


🏁 Script executed:

# Search for environment variable documentation files
fd -e md . | grep -i variable | head -20

Repository: fluent/fluent-bit-docs

Length of output: 206


🏁 Script executed:

# Read the classic-mode/variables.md file to check what it says
cat -n ./administration/configuring-fluent-bit/classic-mode/variables.md | head -50

Repository: fluent/fluent-bit-docs

Length of output: 1881


🏁 Script executed:

# Also read the environment-variables-section.md file being reviewed
cat -n ./administration/configuring-fluent-bit/yaml/environment-variables-section.md | sed -n '65,85p'

Repository: fluent/fluent-bit-docs

Length of output: 996


Documentation inconsistency: default value behavior incomplete in YAML section.

Line 70 states that defaults apply "if the variable is not defined," but the classic-mode documentation at administration/configuring-fluent-bit/classic-mode/variables.md (lines 22-25) explicitly specifies that defaults apply in two cases:

  1. The variable is not defined (unset).
  2. The variable is defined but set to an empty string.

Update this section to match the more complete classic-mode documentation:

Suggested fix
-Fluent Bit supports setting a default value for an environment variable if the variable is not defined. This is useful for providing a fallback when an external or configuration-level variable might be missing.

 The syntax for a default value is `${VARIABLE_NAME:-DEFAULT_VALUE}`.
+
+The default value is used when:
+1. The variable is **not defined** (unset).
+2. The variable is defined but set to an **empty string**.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@administration/configuring-fluent-bit/yaml/environment-variables-section.md`
around lines 68 - 79, The "Default Values" section currently says defaults apply
only "if the variable is not defined"; update the text to state that the
`${VARIABLE_NAME:-DEFAULT_VALUE}` syntax supplies the DEFAULT_VALUE both when
the variable is unset and when it is defined but set to an empty string, so the
behavior matches the classic-mode doc; adjust the explanatory sentence and any
examples (the `service.flush: ${FLUSH_INTERVAL:-5}` example) to reflect this
dual-case behavior and ensure wording mirrors the classic-mode variables.md
description.

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.

1 participant