Secrets
How to migrate a web service that uses environment variables or secrets to Shuttle
Reference
Quickstart
You’ll need to create a Secrets.toml
file in your project root (if in a workspace, in the workspace root).
It should look like this:
Now you can annotate your Shuttle main function like so (using Axum as the example frameowrk):
Set your secrets as environment variables
If you are migrating from another platform to Shuttle, it is likely you are using a lot of environment variables.
shuttle_runtime::SecretStore
implements IntoIter
which allows you to iterate over the store. You can use this to set all of your environment variables like so:
Note that each entry in SecretStore
is a key-value pair, hence the destructuring.
How does it work?
At runtime, the secrets are read from the file (or from Shuttle’s servers if deployed) and provided as an immutable key-value store.
Was this page helpful?