I’m not being allowed access to our company’s Cloudflare account so that I can test independently. I’ll have to work with someone who has access to the actual account.
Can I write my worker using my worker account and then deploy using the company account’s credentials and have my worker run on the company account’s domains?
Or does the company account need to establish a worker account to test with, and then I will have to just transfer code to them so that it can be deployed to where it should be tested?
At my work I’ve automated the building and deploying of a worker script. We automatically deploy new workers to our company account by making use of Cloudflare’s API.
I make use of the following curl command to deploy the new worker via Cloudflare’s API:
You can modify the above command to fit your scenario. In this case I grab the API key, account email and account id from the environment variables CF_API_TOKEN / CF_API_EMAIL / CF_ACCOUNT_ID, and the Worker’s ID/name from CF_WORKER_ID, and then the worker script is grabbed from the ./dist/worker.js location.