Link config files to the vault
vaultfold link writes a vault:// reference into an existing project file
in place of a plaintext value. Comments, ordering and formatting stay as they
were, and the file keeps its mode.
Prerequisites
Section titled “Prerequisites”- An entry in the vault to point at (see store and read).
- The file must already exist.
linkchecks the reference syntax but does not resolve it, so it unlocks nothing and never writes a secret.
Link a key
Section titled “Link a key”For an .env file the second argument is the variable name. For JSON, YAML and
TOML it is a dot path.
vaultfold link .env DB_PASS vault://app/db#passwordvaultfold link config.json database.password vault://app/db#passwordvaultfold link config.yaml database.password vault://app/db#passwordvaultfold link config.toml database.password vault://app/db#passwordEach command prints the fully qualified reference it wrote, for example
vault://myapp/app/db#password, with the vault name filled in.
Use the linked file
Section titled “Use the linked file”A linked .env works with run. Structured files work as templates for
inject, which keeps the format and fills the reference in on its way out.
vaultfold run --env-file .env -- npm startvaultfold inject -i config.yamlWhen link refuses
Section titled “When link refuses”link refuses a third argument that is not a reference, and a file that does
not exist. To store a plaintext value, add it with vaultfold add first and
link its reference.
vaultfold add app/db#password --stdinvaultfold link .env DB_PASS vault://app/db#passwordCurrent limitations
Section titled “Current limitations”- Vault commands start the agent daemon and unlock once;
linkitself does not unlock anything, but therunorinjectthat resolves the reference does. SetVAULTFOLD_NO_AGENT=1to skip the daemon and unlock in-process for that command only. - A reference to an entry or field that was later removed fails when it is resolved, not when it is linked.
injectto standard output prints real values; do not redirect it to a file you will commit.