Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Environment Variables

Variables are stored per profile and exported when the environment is activated (flk activate, nix develop or direnv).

flk env add DATABASE_URL "postgresql://localhost:5432/mydb"
flk env --profile backend add API_URL "http://localhost:3000"
flk env list
flk env remove DATABASE_URL

Storage

They go in the envVars block of .flk/profiles/<profile>.nix:

envVars = {
  DATABASE_URL = "postgresql://localhost:5432/mydb";
  NODE_ENV = "development";
};

Names

Must start with a letter or _ and contain only letters, digits and _. DATABASE_URL and _KEY are valid; 123VAR, my-var are not.

Secrets

Warning: Profile files are plain text and usually committed. Don’t put secrets in them.

Keep secrets in an untracked file instead, for example a .envrc line such as source_env_if_exists .envrc.local with .envrc.local in .gitignore, or load them from a secrets manager.

See also flk env.