Learn
Secrets

Managing app secrets

You can manage secure environment variables - from now on simply secrets - tied to your apps in two ways: using the Wasmer CLI or directly from the dashboard of your app on the wasmer.io (opens in a new tab) website.

We designed both these mechanisms to be secure, intuitive and accomodating.

Creating secrets

From the app dashboard

Once reached the dashboard of the app you want to add secrets to, simply click on Settings and then select the Secrets tab. From that page, you can see the dedicated button used to create a new secret.

If you have a .env-like file defining your secrets and you want to tie them to your app in bulk, you can directly upload that file using the dedicated button.

The wasmer.io fragment used to create secrets
From the CLI

The wasmer app secrets create command allows you to create a new secret for your app. The command is able to automatically infer which app you want to tie your secrets to from simply executing the command in a directory with an app.yaml configuration file. The CLI also has the --app and --app-dir flags to specify the app to tie secrets to directly from the command line.

You can specify the name and value of the secret directly as arguments of the CLI command:

$ wasmer app secrets create MY_NEW_SECRET "its value"
Succesfully created secret(s):
MY_NEW_SECRET

If you want to create multiple secrets in bulk, the subcommand offers the --from-file flag that allows you to specify a .env-like file from which secrets are read off:

$ cat .env
QUOTH_THE_RAVEN="NEVERMORE"
AGAIN_QUOTH_THE_RAVEN="NEVERMORE"
 
$ wasmer app secrets create --from-file=.env         
Succesfully created secret(s):
QUOTH_THE_RAVEN
AGAIN_QUOTH_THE_RAVEN

Listing secrets

From the app dashboard

Once reached the dashboard of the app you want to list secrets of, simply click on Settings and then select the Secrets tab. In that page, you can immediately see the list of secrets tied to your app.

The wasmer.io fragment used to list secrets

It's important to notice that by default the secrets' values are not shown, users must instead click on the eye-like button.

From the CLI

The wasmer app secrets list command allows you to list - but not reveal - all the secrets tied to your app and when they were last updated. The command is able to automatically infer which app you want to tie your secrets to from simply executing the command in a directory with an app.yaml configuration file. The CLI also has the --app and --app-dir flags to specify the app to tie secrets to directly from the command line.

$ wasmer app secrets list        
 Name                   Last updated      
 MY_NEW_SECRET          11m 59s ago 
 QUOTH_THE_RAVEN        3m 34s ago  
 AGAIN_QUOTH_THE_RAVEN  3m 34s ago  

Revealing secrets

From the app dashboard

Once reached the dashboard of the app you want to reveal secrets of, simply click on Settings and then select the Secrets tab. In that page, you can immediately see the list of secrets tied to your app. In order to reveal one of them, simply click on the eye-like button!

The wasmer.io fragment used to reveal secrets

It's important to notice that by default the secrets' values are not shown, users must instead click on the eye-like button.

From the CLI

The wasmer app secrets reveal command allows you to reveal a secret. The command is able to automatically infer which app you want to tie your secrets to from simply executing the command in a directory with an app.yaml configuration file. The CLI also has the --app and --app-dir flags to specify the app to tie secrets to directly from the command line.

$ wasmer app secrets reveal QUOTH_THE_RAVEN
NEVERMORE

If you want to reveal all the secrets tied to the selected app, use the --all flag:

$ wasmer app secrets reveal --all                  
MY_NEW_SECRET="its value"
QUOTH_THE_RAVEN="NEVERMORE"
AGAIN_QUOTH_THE_RAVEN="NEVERMORE"

Updating secrets

From the app dashboard

Once reached the dashboard of the app you want to update secrets of, simply click on Settings and then select the Secrets tab. In that page, you can immediately see the list of secrets tied to your app. In order to update one, click on the three dots and update the value.

The wasmer.io fragment used to update secrets
From the CLI

The wasmer app secrets update command allows you to update an existing secret for your app. The command is able to automatically infer which app you want to tie your secrets to from simply executing the command in a directory with an app.yaml configuration file. The CLI also has the --app and --app-dir flags to specify the app to tie secrets to directly from the command line.

You can specify the name and value of the secret directly as arguments of the CLI command:

$ wasmer app secrets update QUOTH_THE_RAVEN "*nevermore*"
Succesfully updated secret(s):
QUOTH_THE_RAVEN

If you want to update multiple secrets in bulk, the subcommand offers the --from-file flag that allows you to specify a .env-like file from which secrets are read off:

$ cat .env
QUOTH_THE_RAVEN="*nevermore*"
AGAIN_QUOTH_THE_RAVEN="*neeeevermoreee!*"
 
$ wasmer app secrets create --from-file=.env         
Succesfully created secret(s):
QUOTH_THE_RAVEN
AGAIN_QUOTH_THE_RAVEN

Deleting secrets

⚠️

Warning: independently of the method used, once deleted secrets cannot be recovered.

From the app dashboard

Once reached the dashboard of the app you want to delete secrets of, simply click on Settings and then select the Secrets tab. In that page, you can immediately see the list of secrets tied to your app. In order to update one, click on the three dots and delete the secret.

The wasmer.io fragment used to delete secrets
From the CLI

The wasmer app secrets delete command allows you to delete an existing secret for your app. The command is able to automatically infer which app you want to tie your secrets to from simply executing the command in a directory with an app.yaml configuration file. The CLI also has the --app and --app-dir flags to specify the app to tie secrets to directly from the command line.

You can specify the name of the secret directly as arguments of the CLI command. In order to avoid users inadvertedly delete a secret, by default the command asks the user for confirmation:

$ wasmer app secrets delete QUOTH_THE_RAVEN 
 Delete secret 'QUOTH_THE_RAVEN'? · yes
Correctly deleted secret 'QUOTH_THE_RAVEN'

To stop the CLI from asking you safety confirmations, just use the --force flag:

$ wasmer app secrets delete AGAIN_QUOTH_THE_RAVEN --force
Correctly deleted secret 'AGAIN_QUOTH_THE_RAVEN'

If you don't need any of your secrets anymore and want to delete all the secrets tied to the selected app, you can use the --all flag. This command will ask the user confirmation before deleting each secret, one by one. If you are completely sure of deleting all your secrets, you can combine the --all flag with the --force flag.