Guide · Deploy
Push env vars to your deploy platforms
Your keys live in one place on your Mac and in a dashboard for each service that runs your code. Every change means pasting the same value again, and nobody remembers which copy is stale.
In shortLink an environment once with lk remote link, check it with lk remote status, and send it with lk push. Every push asks you to approve it, and nothing is deployed: new values apply on the service's next deploy.
Why the copies drift
A deployed app can't read your keychain, so each platform keeps its own copy of every value. Vercel has one, GitHub Actions has another, Railway and Fly have more. You change a key on your Mac, paste it into one dashboard, and forget the other two. Weeks later a build fails and nothing says which copy is old.
Latchkey can hold the list of places an environment goes. It then compares names and sends values from one place.
Push an environment
The examples use a project called shop with a production environment. Install and sign in to the tool for each service you use first: vercel login, gh auth login, railway login or flyctl auth login. By default Latchkey runs those tools as you and stores no service tokens.
-
Link the environment
Each link names a service and the target on it. Linking asks for approval. A link covers the whole environment, including items you add later.
Terminal lk remote link shop/vercel.preview vercel project=shop environment=preview lk remote link shop/production github repo=me/shop environment=production lk remote link shop/production fly app=shop-apiIn the app, open an item's Edit menu, choose Remote Locations…, then Add a Location…. The sheet asks for the service's details and says whether its command-line tool is installed. Add Location turns on once the details are complete. It never asks for a service token.
-
Check what differs
Status shows names missing on each side, and items whose value changed since they were last pushed. It compares names and doesn't use values.
Terminal lk remote status shop/production -
Rehearse, then push
Use
--dry-runfor a first look before a real push. Then run the push. You can limit it to one link with--toor to chosen items with--only.Terminal lk push shop/production --dry-run lk push shop/production lk push shop/production --to LINK_ID --only shop/production/DATABASE_URLEvery push asks, every time, and no grant covers one. A production target also needs I mean to change production ticked in the approval panel. The Latchkey app does the pushing, so it must be running;
lk pushasks it. With a command-line tool, values reach the tool on standard input, never as arguments. Find a link's ID for--towithlk remote list shop/production. -
See what changed since the last push
After a push, Latchkey records when each item went to each link. An item changed since then gets an orange badge in the list and "Changed since last push" in its detail. Review has a Changes filter that lists those items, and also items not pushed yet, with a Push… action.
Push through an API instead
If you'd rather not depend on the command-line tools, keep the service's access token as an ordinary Latchkey item and name it in the link. Use a token limited to what you push.
lk set VERCEL_TOKEN --kind token
lk remote link shop/vercel.preview vercel project=shop environment=preview token=VERCEL_TOKENThe Mac App Store version can only push this way, and it can't push to GitHub. The CLI reference lists every key each service takes.
A service on a Linux server
A service on your own Linux server can read its credentials from files, for example a systemd unit with LoadCredential=. Give the server a script that stores one credential from standard input, and link the environment to it over ssh. Name each item ADAPTER.ACCOUNT:
lk set distribution/production/bluesky.someone.bsky.social --kind token
lk remote link distribution/production ssh host=myserver script=/srv/app/add-credential.sh
lk push distribution/productionLatchkey runs sudo -n bash SCRIPT ADAPTER ACCOUNT --stdin on the server once per item, with your SSH keys and the value on standard input, and counts it as pushed only when the script prints stored ADAPTER.ACCOUNT. Your account needs a sudoers rule to run that script without a password. Every push to a server counts as production, since the script restarts the service. The script contract has the details; the direct download only.
What this doesn't do
- It deploys nothing. Railway and Fly would deploy by default, so Latchkey turns that off. New values take effect on the service's next deploy, which you start.
- Unlinking stops tracking and pushing. Values already at the service stay there, on a Linux server too: Latchkey can't remove a credential the script stored.
- Pushing Fly secrets through
flyctlsends one line per value, so multi-line values aren't supported on that route. When you push through an API token, variable names must be letters, digits and underscores, and GitHub refuses names starting withGITHUB_. - Latchkey records what it sent, not what a service later does with it. A push always waits for your approval, so a script or agent can start one but can't complete it without you. Agents have no push tool.