serverless-cloudflare-workers
serverless-cloudflare-workers copied to clipboard
Improvement to way we suggest environment variables
Docs currently suggest that best practice is to set the env variables CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_AUTH_EMAIL, CLOUDFLARE_AUTH_KEY, CLOUDFLARE_ZONE_ID in their environment variables every time they run a script
The best practice is to maintain a set of config files config/dev.yml that contains stage-specific config and then read these vars into the serverless.yml
e.g.
custom:
deployVars: ${file(./config/config.${opt:stage}.yml)}
provider:
name: cloudflare
config:
accountId: ${self:custom.deployVars.CLOUDFLARE_ACCOUNT_ID}
zoneId: ${self:custom.deployVars.CLOUDFLARE_ZONE_ID}
I think this would be very useful to see changed in the docs.
"that turns your version-controlled code into Workers" - this I've seen written a few times, but there is no where to help you getting a CI/CD pipeline built if you are new to workers built using the serverless framework.
Having CLOUDFLARE_ACCOUNT_ID etc in the environment vars on my laptop doesn't help when the worker is built on a build agent!