graphcdn.yml can define "environments", which is most useful to have different services for staging and production.
environments key in your
graphcdn.yml to define the different "environments" of your API:
# Defaults when --env is not specifiedname: todo-api-prodschema: https://todo.app/apioriginUrl: https://todo.app/apirules: ...environments:staging:# Use a separate service for staging that points to the staging schema and originname: todo-api-stagingschema: https://staging.todo.app/apioriginUrl: https://staging.todo.app/api
You can then push your configuration to the different environments with the
--env CLI flag:
# Push your local configuration to the staging servicegraphcdn push --env staging
Note that you can only switch
originUrl per-environment. All the other configuration is shared between all the environments and can be pushed there accordingly. You can call your environments anything you want.
Assuming you have a "staging" branch (of some sort) in your VCS, we recommend automatically pushing to your "staging" environment from that CI and to the default (i.e. production) environment on your
In pseudo-code, your CI configuration should do something like:
if ($BRANCH === "staging")graphcdn push --env stagingelse if ($BRANCH === "main")graphcdn push