Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

File Config

By default, individual files will just be deployed to their the relative path to their host/trait with the identical permissions.

However, location, permissions, ownership and more can be configured by adding a bois_config YAML block inside the file itself. The configuration block is commented out using the file’s native comment syntax, so it doesn’t interfere with the actual configuration, and is pruned during deployment.

This allows you to:

  • Override the destination path for a specific file
  • Rename files when deploying them
  • Set custom ownership and permissions
  • Enable templating for dynamic configuration
  • Customize template delimiters to avoid conflicts with native syntax.

Example

Here’s a bash script with a bois_config block:

#!/bin/bash
# bois_config
# template: true
# owner: root
# group: root
# mode: 0o755
# target_path: /usr/local/bin/
# bois_config

echo "Hello from {{ host }}"

The configuration is extracted from between the two # bois_config delimiter lines, and the actual file content (without the config block) is deployed.

Supported Comment Syntaxes

The following comment prefixes are valid: #, //, --, /*, */, **, *, %.

This means you can use bois_config blocks in:

  • Shell scripts, Python, Ruby, YAML (#)
  • C, C++, JavaScript, Rust (// or /* */)
  • SQL, Lua, Haskell (--)
  • LaTeX (%)

If anything is missing, please open a ticket.

Configuration Options

  • target_path: PathBuf (optional) - Override the destination path for this file.
    • If it’s a relative path, it’s treated as relative to the host’s/trait’s target directory (the target_dir override if set, otherwise the global target directory).
    • If it’s an absolute path, that absolute path is used directly.
    • If the path ends with a /, the file is deployed into that directory under its own name. Otherwise, the path is used as the full destination path, including the file name.
    • Takes precedence over any folder-level target_path overrides.
  • rename: String (optional) - Override the filename when deploying. Useful for deploying dotfiles without having dots in your bois directory.
    # bois_config
    # rename: .bashrc
    # bois_config
    
    If rename and a non-dir-style target_path (does not end with /) is set, the filename in target_path will be overwritten and a warning will be emitted.
  • owner: String (optional) - The file owner. Defaults to the current user.
  • group: String (optional) - The file’s assigned group. Defaults to the current user’s group.
  • mode: OctalInt (optional) - File permissions (e.g., 0o644). If not set, the source file’s permissions are preserved.
  • template: Boolean (optional) - Enable Jinja2 templating for this file. Defaults to false. Read the templating docs for detailed info.
  • delimiters: Object (optional) - Customize Jinja2 template delimiters. Useful when the default {{ }} / {% %} syntax conflicts with the file’s content.
    # bois_config
    # template: true
    # delimiters:
    #   prefix: "#"
    #   block: ["{%", "%}"]
    #   variable: ["{{", "}}"]
    #   comment: ["{#", "#}"]
    # bois_config
    
    • prefix: String (optional) - Prefix all opening delimiters with this string (e.g., #{% to make templates behave like comments).
    • block: [String, String] (optional) - Delimiters for logic blocks. Defaults to ["{%", "%}"].
    • variable: [String, String] (optional) - Delimiters for variables. Defaults to ["{{", "}}"].
    • comment: [String, String] (optional) - Delimiters for comments. Defaults to ["{#", "#}"].

Full Example with Custom Delimiters

When working with files that already use {{ }} syntax (like systemd service files or some shell scripts), you can prefix delimiters to avoid conflicts:

[Unit]
Description=Backup Service
# bois_config
# template: true
# delimiters:
#   prefix: "#"
# bois_config

#{% if host == "production" %}
ExecStart=/usr/bin/backup --important-data
#{% else %}
ExecStart=/usr/bin/backup --test-mode
#{% endif %}

With the # prefix, template blocks become #{% and #{{, making them valid comments while still being processed by the template engine.