[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does workerd introduce d1 database configuration #2309

Closed
dairoot opened this issue Jun 21, 2024 · 2 comments
Closed

How does workerd introduce d1 database configuration #2309

dairoot opened this issue Jun 21, 2024 · 2 comments

Comments

@dairoot
Copy link
dairoot commented Jun 21, 2024

How does workerd introduce d1 database configuration

[[d1_databases]]
binding = "DB" 
database_name = "xxxx"
database_id = "xx-f6b5-xx-a19b-xxxx"
using Workerd = import "/workerd/workerd.capnp";

const helloWorldExample :Workerd.Config = (
  sockets = [ ( name = "http", address = "*:8787", http = (), service = "main" ) ]
);


const helloWorld :Workerd.Worker = (
  modules = [
    (name = "worker", esModule = embed "dist/index.js")
  ],
  compatibilityDate = "2024-06-10",

  bindings = [
    (name = "ADMIN_USERNAME", text = "xxxxx"),
    (name = "ADMIN_PASSWORD", text = "xxxxx2"),
    (name = "DEBUG", text = "true" ),
  ],

);
@garrettgu10
Copy link
Collaborator

I'm not sure if I understand what you're asking. What are you trying to do here?

@dairoot
Copy link
Author
dairoot commented Jun 28, 2024

@garrettgu10 Originally, I started my Cloudflare Worker service using wrangler dev. However, for certain reasons, I want to run this service on my own server and therefore do not want to use wrangler dev.

Someone suggested that I use workerd serve xxxx.capnp, but I am not sure how to configure the D1 database in workerd.

For more details, please refer to:
https://discord.com/channels/595317990191398933/1052656806058528849/threads/1253562243195605054

@dairoot dairoot closed this as completed Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants