Skip to content

Basic Usage

Once your project has a monosecret.toml file and you have selected a default provider, most day-to-day work uses a small set of commands.

Check that every required secret can be resolved. Missing values are shown without printing any secrets, and Monosecret offers to set them interactively:

Terminal window
$ monosecret check

Use monosecret check --no-prompt in CI or other non-interactive environments. It exits with an error when a required secret is missing.

Set a secret without putting its value in your shell history:

Terminal window
$ monosecret set API_KEY
Enter value for API_KEY (profile: development): ********
Secret 'API_KEY' saved to keyring (profile: development)

Running set again replaces the stored value. The secret must already be declared in monosecret.toml.

Resolve and print a single secret:

Terminal window
$ monosecret get DATABASE_URL
postgresql://localhost/myapp

Start a command with the resolved secrets available as environment variables:

Terminal window
$ monosecret run -- npm start

The -- separates Monosecret’s options from the command you want to run. Monosecret stops before starting the command if a required secret is missing.

Declare a new secret without editing monosecret.toml by hand, then store its value:

Terminal window
$ monosecret add API_KEY --description "API access token"
$ monosecret set API_KEY

add changes only the declaration. It never asks for or stores the secret value.

Remove a stored value from its provider:

Terminal window
$ monosecret delete API_KEY

This leaves the declaration in monosecret.toml, so the project still records that it expects API_KEY. See the CLI reference for deleting multiple values or using --all.

Your configured defaults apply automatically. Override them for one command with --profile or --provider:

Terminal window
$ monosecret check --profile production
$ monosecret run --provider dotenv://.env.test -- npm test

These options do not change your saved preferences.