Skip to content

kp:// references

A kp:// reference says where a value lives in a vault, never the value, so a file of references can be committed. keypaste run resolves each one when it starts a command.

FormNames
kp://<project>/<stage>/<KEY>One variable of one stage of an environment, such as kp://acme-api/staging/DATABASE_URL.
kp:///<group>/<title>#<field>One field of one item, by its group and title. Without #<field> it names the password.

Every character other than letters, digits, -, ., _ and ~ is percent-encoded, so a reference holds no space, quote or separator of its own, and a title holding / stays one segment.

A .env.keypaste is a .env whose values are references:

Terminal window
keypaste env export acme-api -p staging > .env.keypaste
DATABASE_URL=kp://acme-api/staging/DATABASE_URL

The desktop app’s Environments writes the same file with Edit › Export .env.keypaste…. Run with it:

Terminal window
keypaste run --env-file .env.keypaste -- npm start
  • Every reference resolves, or nothing starts.
  • A line whose value is not a reference passes through as written. Those literal values are listed before the vault opens, because a cloned repository’s file can set a value such as HTTPS_PROXY.
  • With no environment and no --env-file, keypaste run uses the .env.keypaste in the folder the app saved for an environment, and only when it names nothing but that environment’s variables.
  • An agent’s run tool takes references in its env (The bridge and its tools).
  • keypaste share takes a reference in place of an item, and shares the field it names (Share links).

A reference file is only as trustworthy as whoever wrote it: read a cloned repository’s .env.keypaste before you run with it (THREATS T-31).