Skip to content

Conversation

@nikaro
Copy link

@nikaro nikaro commented Jan 16, 2026

What does this PR do?

Add an "cmd substitution" that allow to use password manager to pass credentials in configuration.

Fixes #7487

How did you verify your code works?

  • Added test case
  • Ran bun dev with some {cmd:op read ...} in my configuration file

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

PR #8198: feat: add apiKeyCommand for dynamic API key retrieval
#8198

Why it might be related: Both PRs appear to address the same problem—dynamically retrieving credentials/API keys at runtime rather than storing them statically in configuration. PR #8198 uses apiKeyCommand for dynamic API key retrieval, while PR #8917 uses exec substitution for the same purpose. These are different implementation approaches to solving the same issue (#7487).

}
const command = match.replace(/^\{exec:/, "").replace(/\}$/, "")
try {
const result = await Bun.$`sh -c ${command}`.text()
Copy link
Author

Choose a reason for hiding this comment

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

I used this instead of the supposedly more secure Bun.Spawn because it is much simpler as we don't have to parse/split the user command and handle all the quirks (do not split quoted arguments, what to do about pipes and redirections, etc.).

@betaboon
Copy link

i have no say in this, but it would be fantastic if this could become {cmd:foo bar} instead, because it aligns well with some other tools that i am using.

@nikaro
Copy link
Author

nikaro commented Jan 16, 2026

i have no say in this, but it would be fantastic if this could become {cmd:foo bar} instead, because it aligns well with some other tools that i am using.

I don't mind, I actually had some hesitation between exec and cmd. I will change.

@nikaro nikaro force-pushed the feat/exec-substitution branch from 3702bdf to 8bafe55 Compare January 16, 2026 16:36
@nikaro nikaro changed the title feat: add exec substitution for config variables feat: add cmd substitution for config variables Jan 16, 2026
@nikaro nikaro force-pushed the feat/exec-substitution branch from 8bafe55 to 888ef29 Compare January 16, 2026 20:31
@nikaro nikaro force-pushed the feat/exec-substitution branch from 888ef29 to 83fd4ee Compare January 16, 2026 20:40
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.

[FEATURE]: exec variable substitution

2 participants