Skip to main content
Your app can use a service of your own: a data feed, your database, a partner’s API. A secret is the key to that service. You give it to your app once, your server reads it as process.env.NAME, and nobody can read it back, you and Bankroll included.
This page is for an app that Bankroll hosts: one made with bankroll apps create or in the Bankroll app. An app on your own origin sets its environment variables where it is hosted.

Set a secret

You need version 1.3.0 or later of the Bankroll CLI. bankroll --version prints yours, and npm i -g @joinbankroll/cli@latest updates it. In your app’s folder:
The command asks for the value and shows nothing while you type or paste. The value is never an argument, so it does not stay in your shell’s history. A value of several lines, such as a PEM key, comes from a file, and a pipe works too:
Keep your own copy of the value where you keep keys. Bankroll cannot show it to you again. To change a value, set it again.

Test and live

Your app has a test version and a live version, and each has a value of its own. With no option, a command is for both. --test or --live names one, so a test database and a live database can sit under the same name:
A version reads its secrets when it is built. So set and rm build the versions again and show the build, the way bankroll wait does. Several names in one command share one build, and --no-rebuild leaves the build for later. A rebuild counts as one of your builds for the day. The live version is built again only while it serves the commit that its live branch holds. If you pushed to live and that build did not go through, the secret is read at your next publish.

Read a secret

Read it on the server, in a route handler or a server module:
  • Never read a secret in a client component, and never send one to the browser.
  • Write your app so that it runs without the secret, with that one feature closed. A fresh clone of your app does not have it.
  • To use the secret on your own computer, put the value in .env.local. Git ignores that file, and Bankroll never sees it.

List and remove

The list shows names and the day each value was set. It never shows a value.

Names

A name is capital letters, digits and underscores, and starts with a letter: KALSHI_API_KEY, DATABASE_URL. Three kinds of name are refused: A version holds up to 20 secrets, each up to 8 KB.

Remixing

A remix copies an app’s code and never its secrets, so the copy of an app that needs one would not work. An app that holds a secret cannot be remixed.