⚠️ This lesson is retired and might contain outdated information.

Create Environment Variables with Cloudflare Wrangler

Obinna Ekwuno
InstructorObinna Ekwuno
Share this video with your friends

Social Share Links

Send Tweet

Learn how to use the [vars] key from Cloudflare Wrangler to create a table of environment variables for your worker scripts.

Instructor: [0:00] If we head over to our wrangler.toml file, we can now add the credentials we need to get on POST data from our Airtable, by using the vars key.

[0:11] The first credential we're going to add, the Airtable base ID. If we copy this, we would want to follow the environment variables format and name this Airtable Base ID. Let's paste that in there.

[0:27] The next one we want to add is our Airtable table name, which is Feedback Table. The next credential we want add is the API key. Your API key would be used for authorization. To add keys that have to be secrets, you can add them and get an API key by clicking Show API Key.

[0:54] To add keys that have to be secrets, you can add them by using Wrangler secrets, and then put your API credential. This would encrypt your credential on your worker and wouldn't be visible to other users.