Skip to content

Commit

Permalink
Few fixes to get DatadogLogger working.
Browse files Browse the repository at this point in the history
  • Loading branch information
aboodman committed Feb 17, 2022
1 parent a41abdd commit 6889b00
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ yarn-error.log*
$ CloudFlare worker
.mf/
tsconfig.tsbuildinfo
.env

2 changes: 1 addition & 1 deletion src/pages/d/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Home() {

const workerHost =
process.env.NEXT_PUBLIC_WORKER_HOST ??
"wss://replidraw-do.replicache.workers.dev";
"wss://replidraw.replicache.workers.dev";
const workerURL = `${workerHost}/connect`;
console.info(`Connecting to worker at ${workerURL}`);
new Client(r, roomID, workerURL);
Expand Down
8 changes: 2 additions & 6 deletions worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { DatadogLogger, Server as BaseServer } from "reps-do";
export { worker as default } from "reps-do";
import { mutators, type M } from "../src/datamodel/mutators.js";

type TODO = any;
export class Server extends BaseServer<M> {
constructor(state: DurableObjectState, env: TODO) {
constructor(state: DurableObjectState, env: Record<string, string>) {
console.log("dd key", env.DATADOG_API_KEY);
const abortController = new AbortController();
const logger = new DatadogLogger({
apiKey: env.DATADOG_API_KEY,
Expand All @@ -19,10 +19,6 @@ export class Server extends BaseServer<M> {
mutators,
state,
logger,
async onClose() {
await logger.flush();
abortController.abort();
},
});
}
}
7 changes: 5 additions & 2 deletions wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "replidraw-do"
name = "replidraw"
type = "javascript"

account_id = "84dd7a44a4da314095315fb89b24251c"
account_id = ""
workers_dev = true
# route = ""
# zone_id = ""
Expand All @@ -28,3 +28,6 @@ main = "./index.mjs"

[miniflare]
durable_objects_persist = true

#[secrets]
#DATADOG_API_KEY

0 comments on commit 6889b00

Please sign in to comment.