Secrets
Learn how to store secrets in RAW.
How to create
Secrets are a simple mechanism to hide sensitive information. Secrets are essentially a key-value pair with the key being the secret name and the actual secret payload being the value. Users have the ability to create arbitrary named secrets and employ them in Snapi queries.
In order to add a secret, select the Secret from the Credentials tab. Then enter the secret payload. In this example, an tmpdb_api_key is stored as a secret for our demo TMDB API.
Upon saving the secret, it can be seen in the list of available Credentials.
How to use from Snapi
A concrete example of secret usage is the following code:
main(code: string = null) =
let
airports = PostgreSQL.InferAndRead(
"raw", "example", "airports",
host = "example-psql.raw-labs.com",
username = "guest",
password = Environment.Secret("guest-password")
)
in
Collection.Filter(airports, x -> Nullable.IsNull(code) or x.iata_faa == code)
In this code we stored the database password in a secret guest-password
and use to access the table "airports".