Skip to content

fix(cli): mount the config from an absolute --config path correctly - #497

Open
JasonVranek wants to merge 1 commit into
mainfrom
fix/init-absolute-config-path
Open

fix(cli): mount the config from an absolute --config path correctly#497
JasonVranek wants to merge 1 commit into
mainfrom
fix/init-absolute-config-path

Conversation

@JasonVranek

Copy link
Copy Markdown
Collaborator

The bug

cb init builds the config bind-mount source as ./{config_path}:

config_volume: Volumes::Simple(format!("./{}:{}:ro", config_path.display(), CONFIG_DEFAULT)),

The ./ is needed for a relative path — compose reads a source with no / or ./ prefix as a named volume, so cb-config.toml:/cb-config.toml:ro would quietly create a volume named cb-config.toml instead of mounting the file.

It is applied unconditionally, though, so an absolute --config produces .//abs/path/cb-config.toml. Compose resolves that relative to the project directory, docker materialises a root-owned directory tree at it, and the sidecar comes up with a directory mounted at /cb-config.toml.

Reproduced end to end:

$ commit-boost init --config /abs/path/cb-config.toml --output .
$ grep cb-config.toml cb.docker-compose.yml
    - .//abs/path/cb-config.toml:/cb-config.toml:ro

$ docker compose up -d && docker logs cb_pbs
Error:
   0: Unable to find config file: "/cb-config.toml"
   1: Is a directory (os error 21)

and it leaves a root-owned ./abs/path/... tree next to the compose file that the operator then needs sudo to clean up.

The fix

Add the prefix only when the path needs it. Every other mount the generator emits (chain spec, mux key files, signer keys/secrets, proxy dirs) already passes its path through unchanged; the config mount was the only one prefixing.

Blast radius

  • Relative --config — what every doc example uses (commit-boost init --config cb-config.toml) — generates a byte-identical compose file. No behaviour change.
  • Absolute --config goes from broken to working.
  • No config-format or docs change.

Tests

test_init_compose_file_pbs_service_structure already invoked commit-boost init with an absolute --config (a tempdir path) but asserted only that some volume ends with :/cb-config.toml:ro, so the bug rendered underneath it. It now pins the host side of the mount as well, which fails without this change. A unit test covers the helper directly (absolute, relative, ./- and ../-prefixed).

@JasonVranek
JasonVranek requested a review from a team September 10, 2026 19:41
@JasonVranek
JasonVranek force-pushed the fix/init-absolute-config-path branch from e239761 to 67033e1 Compare September 11, 2026 02:03
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