Variables and secrets

Configuration the app reads from its environment.

Set, list and remove

$ shim env set LOG_LEVEL=info REGION=eu
$ shim env list
$ shim env unset REGION

Changes reach the running app in a moment. You do not need to deploy again. The same can be done in the Variables section of the app in the dashboard, which can also take a pasted .env file.

Secrets

$ shim env set STRIPE_KEY=sk_live_... --secret

A secret is write-only. Once saved, its value cannot be read back with the command line or the dashboard; it can only be replaced or removed. Keep your own copy.

To keep a secret out of your shell history, give - as the value and pipe it in:

$ printf %s "$STRIPE_KEY" | shim env set STRIPE_KEY=- --secret

Variables that are not secret can also be listed in the [env] table of shim.toml. Secrets never go there.

Names

A name starts with a letter and uses letters, digits and underscores, up to 128 characters. These are reserved:

  • PORT, TZ, LD_PRELOAD, LD_LIBRARY_PATH
  • anything starting with AWS_, LAMBDA_, SHIM_ or an underscore

Variables Shim sets

NameWhenValue
PORTalways8080
DATABASE_URLwhile the app has a databasethe connection string to use from the app
DATABASE_URL_UNPOOLEDwhile the app has a databasea direct connection, for migrations and tools that hold one session
SHIM_APP_TOKENwhen the app may call another appthe token to send

These show up as secrets under Set by Shim, cannot be changed or removed by hand, and count towards the app's variable limits.

Your own database

To use a database you already run, set DATABASE_URL yourself, like any other variable. Shim leaves it alone and sets no DATABASE_URL_UNPOOLED. An app uses one or the other: while it has a Shim database you cannot set DATABASE_URL, and while you have set it Shim will not create one. Remove yours first to switch.

Limits

  • One value can be at most 2,048 bytes.
  • All names and values of one app must fit in 3,500 bytes together.
  • The number of variables depends on the plan.