Cloudflare CLI
About a week ago, I added a simple script to my environment to make it easier to purge Cloudflare caches. Read more about it here.
But it was a wee bit too simple: I didn’t want to check my API keys into any repo, and I also didn’t want to keep it lying around so I could pass it in as an option.
And Behold!
Cloudflare CLI
I improved the script to make it so you can easily store your config locally. Now, your API key, email, and site-or-zone can be stored locally as:
- Environment variables
- Flags (as before)
- In a
Cloudfile
at the root of your project
And the site name can be stored in a CNAME
file, which is already required for Github pages sites with custom domains.
I added it to my dotfiles install script where it’s symlinked to cloudflare
, making it easier to type and remember.
Check it out on Github!
github.com/thelowlypeon/cloudflare-cli
Right now its functionality is limited to fetching your site’s zone and purging the cache. Feel free to fork it and make it better!