luna secrets
Set, remove and list the secrets an environment's lunas read as ctx.env.
luna secrets sets, removes and lists an environment’s secrets. Its lunas read them as ctx.env.
luna secrets set STRIPE_KEY
Reference
luna secrets <COMMAND>
Every subcommand acts on one environment, and takes these options.
| Option | Type | Default | Does |
|---|---|---|---|
--dir <DIR> |
path | . |
The app’s folder. Its env file names the project and environment. |
--env <ENV> |
text | LUNA_ENV, then production |
The environment, by name. |
--project <PROJECT> |
text | LUNA_PROJECT |
The project, by name or as organisation/project. |
--tenant <TENANT> |
text | The environment’s own | A tenant added to the environment, by name. |
--token <TOKEN> |
text | LUNA_TOKEN, then your login |
An API token or account key to act with. |
luna secrets set
Sets a secret. The value comes from standard input, never from the command line.
luna secrets set [OPTIONS] <NAME>
| Option | Type | Default | Does |
|---|---|---|---|
<NAME> |
text | Required | The secret’s name: capital letters, digits and underscores, not starting with a digit, at most 128 characters. |
At a terminal, the CLI asks for the value, which shows as you type. Otherwise it reads all of standard input and drops one final line break. The value is UTF-8 text of at most 64 KiB, and an empty value is refused.
luna secrets unset
Removes a secret.
luna secrets unset [OPTIONS] <NAME>
| Option | Type | Default | Does |
|---|---|---|---|
<NAME> |
text | Required | The secret’s name. |
luna secrets list
Prints the names of the environment’s secrets, one a line. Values are never read back.
luna secrets list [OPTIONS]
| Option | Type | Default | Does |
|---|---|---|---|
--json |
flag | Off | Prints the answer as JSON. |
Good to know
- Setting or removing a secret deploys a new version of the environment with the same code, so that running lunas take up the change. When the environment has been deployed to, the CLI prints the new version’s number.
- An environment made with
luna env create --fromnever gets the other environment’s secrets.
Examples
Set a secret from a file
luna secrets set STRIPE_KEY < stripe-key.txt
Set a secret in production
printf '%s' "<VALUE>" | luna secrets set STRIPE_KEY --env production
List the secrets of an environment
luna secrets list --env staging
Remove a secret
luna secrets unset STRIPE_KEY