When you use the graphcdn
CLI, you'll work with one configuration file, which is called graphcdn.yml
.
This is an example graphcdn.yml
file:
name: my-app
schema: https://end.point
originUrl: https://end.point
injectHeaders: false
headers:
x-gcdn-password: my-password
scopes:
AUTHENTICATED: header:Authorization|cookie:session
rules:
- description: Cache all queries
maxAge: 900
swr: 900
scope: AUTHENTICATED
types:
Query: true
environments:
staging:
name: my-app-staging
schema: https://staging.end.point
originUrl: https://staging.end.point
Reference
name
The name of your service
schema
A reference to your schema. This can be either a url like https://api.end.point/graphql
(only works if introspection is enabled) or a reference to a local schema.grahql
file like ./api/schema.graphql
originUrl
The url of your production backend you want your service to proxy to.
injectHeaders
Should your GraphCDN service inject the headers you provided into the edge? This might be required if you have some default headers that are always needed. Use this with care though, as you might expose unwanted auth data with this.
headers
A key-value map of headers and their values.
rules
The core of GraphCDN - the cache configuration. Read more about this in the cache configuration documentation.
scopes
A key-value map of custom cache scopes to scope cached data per-user. Read more about this in the scopes documentation.
environments
A key-value map of environments to push to, e.g. "staging". See the environments documentation for more information.