CLI tool for:
- Uploading local VCL to Fastly.
- Diffing local VCL with remote Fastly VCL.
- Listing remote Fastly VCL files.
- Deleting remote Fastly VCL files.
- Creating, Activating and Validating Fastly service versions.
This tool is an abstraction layer built on top of "go-fastly".
go get github.com/integralist/go-fastly-cli
GOOS=darwin GOARCH=386 go build fastly.go
fastly <flags> [diff <options>] fastly <flags> [upload <options>] fastly <flags> [list <options>] fastly <flags> [delete <options>]
fastly -help -activate string specify Fastly service version to activate -debug show any debug logs and subcommand specific information -dir string the directory where your vcl files are located -help, -h show available flags -match string regex for matching vcl directories (fallback: VCL_MATCH_PATH) -service string your Fastly service id (fallback: FASTLY_SERVICE_ID) -settings string get settings for the specified Fastly service version (try: 'latest') -skip string regex for skipping vcl directories (will also try: VCL_SKIP_PATH) -status string get status for the specified Fastly service version (try: 'latest') -token string your fastly api token (fallback: FASTLY_API_TOKEN) -validate string specify Fastly service version to validate -version show application version
fastly diff -help Usage of diff: -version string specify Fastly service version to verify against
fastly upload -help Usage of upload: -clone string specify a Fastly service version to clone from (files will upload to it) -latest use latest Fastly service version to upload to (presumes not activated) -version string specify non-active Fastly service version to upload to
fastly list -help Usage of list: -version string specify Fastly service version to list VCL files from
fastly delete -help Usage of delete: -name string specify VCL filename to delete -version string specify Fastly service version to delete VCL files from
The use of environment variables help to reduce the amount of flags required by the
fastly CLI tool.
For example, I always diff against a 'stage' service in our Fastly account and so I don't want to have to put in the same credentials all the time.
Below is a list of environment variables this tool supports:
Use the relevant CLI flags to override these values
Note: all examples presume
FASTLY_SERVICE_IDenv vars set
# view status for the latest service version fastly -status latest # view status for the specified service version fastly -status 123 # view settings for the latest service version fastly -settings latest # view settings for the specified service version fastly -settings 123 # validate specified service version fastly -validate 123 # activate specified service version fastly -activate 123 # view latest version of remote service vcl files fastly list # view version 123 of remote service vcl files fastly list -version 123 # delete specified vcl file from latest version of remote service fastly delete -name test_file # delete specified vcl file from specific version of remote service fastly delete -name test_file -version 123 # diff local vcl files against the lastest remote versions fastly diff # diff local vcl files against the specific remote versions fastly diff -version 123 # enable debug mode # this will mean debug logs are displayed # for 'diff' subcommand: also display per file diff fastly -debug diff -version 123 # upload local files to remote service version fastly upload -version 123 # token and service explicitly set to override env vars fastly -service xxx -token xxx upload -version 123 # modify VCL directory temporarily + use different token/service id VCL_MATCH_PATH=foo fastly -token $FASTLY_API_TOKEN_FOO -service $FASTLY_SERVICE_ID_FOO diff # clone specified service version and upload local files to it fastly upload -clone 123 # upload local files to the latest remote service version fastly upload -latest # clone latest service version available and upload local files to it fastly upload
To compile binaries for multiple OS architectures:
To start up a dockerized development environment (inc. Vim):
To install a local binary for testing (darwin):
To remove all compiled binaries, vim files and containers:
- Ability to 'dry run' a command (to see what files are affected, e.g. what files will be uploaded and where)
- Ability to diff two remote services (not just local against a remote)
- Ability to upload individual files (not just pattern matched list of files)
- Ability to display all available services (along with their ID)
- Better diffing tool than linux
- Setup for homebrew install
- Test Suite