forkable project with d1

heya, good folks of d1! I'm currently building a project on cloudflare workers+pages+d1 that I'd like to be forkable. So the ideal workflow for the users is: 1. fork the repo of my deployed solution 2. set things up 3. run GitHub Action and get a URL Now, for project without D1 I can at least theoretically imagine how the step 2 would look like. I. e. "create a cloudflare account, get token, paste token to GitHub Action Secrets". But with D1 I'm a bit stuck. The reason I'm stuck is that the unique id of the database is in wrangler.toml and that the d1 is not even creatable in the dashboard until the first worker is deployed. So the user flow for setup becomes something like: a. run deployment action with database turned off. It will deploy the worker that can't work because there's no database b. go create a database in the dashboard c. copy-paste the details of the database from dashboard to repo d. deploy the solution again - this time with database enabled Is there a better way? Am I missing something?
4 Replies
kojo
kojoOP•15mo ago
also fun: the error suggests me to create a d1 using the UI but the UI won't let me touch a database until a first worker is successfully deployed
No description
kojo
kojoOP•15mo ago
these are my wrangler.toml and github action code if you're into reading that
TigersWay
TigersWay•15mo ago
I'd be also VERY interested in some light on that topic 😄
Paolo of Lost Pages
Paolo of Lost Pages•15mo ago
Just wondering, can't you deploy a mock worker, create a db, then deploy your project?
Want results from more Discord servers?
Add your server