Is there a PUT Secret API call for cloudflare for Pages?
Hi guys - as the title points out - i've checked out api.cloudflare etc but no dice. I need to store env variables provided by the user.
13 Replies
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
Perfect thanks @Chaika - couldn't see this for looking!
Does this require a redeployment for the secret to become active?
yup
bugger
any other options we have currently?
I need to store private keys on the fly.
depends what you need. There's KV or R2 but both have their own latency costs and such
Workers for example have the same quick with environment variables except it just does the redeployment automagically for you
KV secure enough to put a private key?
I guess I could encrypt the private key with a key in the environment variables
🤔
https://community.cloudflare.com/t/credentials/77012/7?u=chaika
I mean Secrets are encrypted at rest and so is KV
Cloudflare Docs
Data security · Cloudflare Workers KV
This page details the data security properties of KV, including:
So that looks fine just would need to watch out for the Access to KV via cloudflare dashboard as the value is not hidden
Thanks Chaika
I had one other question if you don't mind as well.
Cron from sveltekit?
Is the best approach here a durable worker with an alarm?
I'm using built in API routes into sveltekit.
Or is cron exposed to sveltkit via platform env?
Pages doesn't support CRON, or defining Durable Objects (although you can define them from a worker and then use them from a pages project)
Can't you use on sveltekit / pages - just going on whats in the docs for sveltekit - https://kit.svelte.dev/docs/adapter-cloudflare
SvelteKit docs
Cloudflare Pages • SvelteKit documentation
you can use them when they are defined/created in a seperate worker and then bound to
Yep fine.
thanks.