Skip to content

Starter kit demonstrating how to use the Fastly KV store from within a Go-based Fastly compute project.

License

Notifications You must be signed in to change notification settings

fastly/compute-starter-kit-go-kv-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compute Starter Kit Go KV Store

Fastly KV Store is a globally consistent key-value storage accessible across the Fastly Network. This makes it possible for your Compute@Edge application to read and write from KV-stores. The application shows how to use Fastly KV Store within a Go Compute@Edge application.

For more details about other starter kits for Compute@Edge, see the Fastly developer hub

Deploying the project to Fastly

Note that Fastly Services have to have unique names within a Fastly Account.

To create and deploy to a new Fastly Service run the command and follow the instructions:

fastly compute publish

That is it, we now have a Fastly Service, a Fastly KV Store and have them linked together!

You can view real-time logs for the Fastly Service by running:

fastly log-tail

Adding entries to the KV Store

It is possible to add key-value pairs to an KV Store using the Fastly CLI like so:

fastly kv-store-entry create --store-id=$FASTLY_KV_STORE_ID --key-name=$KEY --value=$VALUE

For example, here is how you could add to the KV Store named my-store a key named readme whose value is the contents of README.md:

fastly kv-store-entry create --store-id="$(fastly kv-store list --json | jq -r '.Data[]|select(.Name=="my-store").ID')" --key-name="readme" --value="$(cat README.md)"

Security issues

Please see our SECURITY.md for guidance on reporting security-related issues.

About

Starter kit demonstrating how to use the Fastly KV store from within a Go-based Fastly compute project.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages