Using Secrets in Keel
Managing application sensitive credentials can be a bit of a pain, so Keel provides a built-in secret management feature that's both secure and easy to use.
From our custom function earlier, You can see that we are using secrets option pull the API credentials for our Cloudinary account.
cloudinary.config({
cloud_name: ctx.secrets.CLOUD_NAME,
api_key: ctx.secrets.API_KEY,
api_secret: ctx.secrets.API_SECRET,
});
We need to give Keel access to these credentials using secrets (opens in a new tab). You can do this by creating a keelconfig.yaml
file and paste in the following details
secrets:
- name: CLOUD_NAME
- name: API_KEY
- name: API_SECRET
- name: UPLOAD_PRESET
With this, we are exposing our secrets to the Keel runtime and VS Code extension. The next thing we need to do is set this secrets locally and in the Keel console so that we can make use of the custom function we created.
To set your secrets locally, you can do this by running the following commands:
keel secrets set CLOUD_NAME 'your-cloudinary-cloud-name'
To set your secrets in the Keel console, head over to Secrets on the side bar of the console. In the “Secrets” section of the page, please click on ”add secrets” and provide the secret name and value just like you did locally.
You’ll need to set all the secrets mentioned in the keelconfig.yaml