Code Monkey home page Code Monkey logo

cloudflare-cli's Introduction

Cloudflare® CLI

Command line tools for Cloudflare

Installation

To install, place cloudflare-cli anywhere in your PATH. Optionally alias it to something easier, like cf.

Configuration

Cloudfile

The easiest way to run this per project is to keep a Cloudfile in your project's root directory.

There are three variables needed to purge any cache:

  • Your API key (get it here)
  • Your email (for your Cloudflare account)
  • The site's "zone". If you don't know this, you can set a site instead, and cloudflare-cli will look up the zone

So, your cloudfile would look like this:

CLOUDFLARE_API_KEY=myCloudflareAPIKey
[email protected]
CLOUDFLARE_SITE=mysite.com

Or perhaps:

CLOUDFLARE_API_KEY=myCloudflareAPIKey
[email protected]
CLOUDFLARE_ZONE=123eqw7iqtas

Environment Variables

You may have noticed that the Cloudfile looks a lot like bash variable assignments. That's because it is!

So you can also set each of those values by environment variable.

Site Name

You can save the effort of setting your site name in the Cloudfile by instead placing a file called CNAME in the root of your project, containing only the site name.

This is particularly useful for sites hosted on Github pages, which depend on a CNAME file for custom domain names.

You can also pass in some or all as flags with your command:

  -z     The Cloudflare zone
  -s     Site name, eg mysite.com
         This is not required if a zone is defined
  -e     The email address associated with your Cloudflare account
  -k     Your Cloudflare API key

Commands

Zone

cloudflare-cli zone

This will display the zone corresponding to your site. This may be helpful if you'd prefer to set the zone in your config, rather than looking it up each time. (This will make things a bit snappier.)

Purge

cloudflare-cli purge

This will purge all of the files cached by Cloudflare for your site. It's very fast to run.

Contributing

Fork the repo, and submit a pull request!

More

Read more on my website.

cloudflare-cli's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.