GithubHelp home page GithubHelp logo

liftedkilt / cloudflare-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danielpigott/cloudflare-cli

0.0 3.0 0.0 1.15 MB

CLI for interacting with Cloudflare

License: MIT License

JavaScript 100.00%

cloudflare-cli's Introduction

cloudflare-cli

CLI for interacting with Cloudflare

Installation

npm install -g cloudflare-cli

Setup

You can setup a yaml config file with default parameters e.g. token and email. By default cfcli will look for ".cfcli.yml" in your home directory (you can also pass in a config file with -c)

Configuration Example

If you have only one cloudflare account you can set it up as below:

defaults:
    token: <cloudflare-token>
    email: <[email protected]>
    domain: <default-cloudflare-domain>

If you have multiple cloudflare accounts, and you can set up accounts as below:

defaults:
    account: work
accounts:
    work:
        token: <cloudflare-token>
        email: <[email protected]>
        domain: <default-cloudflare-domain>
    play:
        token: <cloudflare-token>
        email: <[email protected]>
        domain: <default-cloudflare-domain>

You can then use -u play to interact with the second cloudflare account.

Usage

NAME
    cfcli - Interact with cloudflare from the command line

SYNOPSIS
    cfcli [options] command [parameters]

OPTIONS:
    -c  --config    Path to yml file with config defaults (defaults to ~/.cfcli.yml
    -k  --token     Token for your cloudflare account
    -e  --email     Email of your cloudflare account
    -u  --account   Choose one of your named cloudflare accounts from .cfcli.yml
    -d  --domain    Domain to operate on
    -a  --activate  Activate cloudflare after creating record (for addrecord)
    -f  --format    Format when printing records (csv or table)
    -t  --type      Type of record (for dns record functions)
    -l  --ttl       Set ttl on add or edit (120 - 86400 seconds, or 1 for auto)
    -h  --help      Display help

COMMANDS:
    addrecord <name> <content>
        Add a DNS record. Use -a to activate cf after creation
    devmode on|off
        Toggle development mode on/off
    disablecf <name>
        Disable cloudflare caching for given record
    editrecord <name> <content>
        Edit a DNS record.
    enablecf <name>
        Enable cloudflare caching for given record
    listdomains
        List domains in your cloudflare account
    listrecords
        List dns records for the domain
    purgecache
        Clear all cache files for the domain
    purgefile <url>
        Purge file at given url
    removerecord <name> [content]
        Remove record with given name and optionally specific value

Examples

Add a new A record (mail) and activate cloudflare (-a)

cfcli -a -t A addrecord mail 127.0.0.1

Edit a record (mail) and set the TTL

cfcli --ttl 120 editrecord  mail 127.0.0.1

Remove all records with the name test

cfcli removerecord test

Remove record with name test and value 1.1.1.1

cfcli removerecord test 1.1.1.1

Export domain records for test.com to csv

cfcli -d test.com -f csv listrecords > test.csv

Purge a single file from cache

cfcli purgefile http://test.com/script.js

Enable dev mode for test.com domain

cfcli -d test.com devmode on

cloudflare-cli's People

Contributors

danielpigott avatar yhsiang avatar

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.