**Migrate from TOML to JSON configuration for workers**

Replaced Wrangler TOML files with JSON configuration for email and analytics workers, updating compatibility dates and maintaining existing settings. Updated email metadata and replaced hardcoded email addresses with example addresses for better abstraction. Adjusted deployment scripts in `package.json` to align with the new worker structure.
This commit is contained in:
geoffsee
2025-05-27 15:07:11 -04:00
committed by Geoff Seemueller
parent d0d55f58a6
commit fb7031fc89
7 changed files with 47 additions and 37 deletions

View File

@@ -9,8 +9,8 @@
"client:build": "vite build", "client:build": "vite build",
"server:build": "WRANGLER_LOG=info wrangler build", "server:build": "WRANGLER_LOG=info wrangler build",
"deploy": "CI=true vite build && wrangler deploy --minify", "deploy": "CI=true vite build && wrangler deploy --minify",
"deploy:email-service": "wrangler deploy -c workers/email/wrangler-email.toml", "deploy:email-service": "wrangler deploy --cwd workers/email",
"deploy:analytics-service": "wrangler deploy -c workers/analytics/wrangler-analytics.toml", "deploy:analytics-service": "wrangler deploy --cwd workers/analytics",
"tail": "wrangler tail", "tail": "wrangler tail",
"tail:email-service": "wrangler tail -c workers/email/wrangler-email.toml", "tail:email-service": "wrangler tail -c workers/email/wrangler-email.toml",
"tail:analytics-service": "wrangler tail -c workers/analytics/wrangler-analytics.toml", "tail:analytics-service": "wrangler tail -c workers/analytics/wrangler-analytics.toml",

View File

@@ -37,7 +37,7 @@ const onRenderHtml: OnRenderHtmlAsync = async (
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="description" content="Maker Site"> <meta name="description" content="Maker Site">
<script> <script>
window.ga_tid = "resume-site"; window.ga_tid = "open-gsio";
window.ga_api = "/api/metrics"; window.ga_api = "/api/metrics";
</script> </script>
<script src="/cfga.min.js" async></script> <script src="/cfga.min.js" async></script>

View File

@@ -1,17 +0,0 @@
main="analytics_worker.js"
name = "analytics"
compatibility_date = "2024-12-20"
routes = [
{ pattern = "metrics.seemueller.io", custom_domain = true }
]
[dev]
port = 3003
[placement]
mode = "smart"
[[analytics_engine_datasets]]
binding = "ANALYTICS_ENGINE"
dataset = "global_analytics"

View File

@@ -0,0 +1,23 @@
{
"compatibility_date": "2025-05-27",
"main": "analytics_worker.js",
"name": "analytics",
"analytics_engine_datasets": [
{
"binding": "ANALYTICS_ENGINE",
"dataset": "global_analytics"
}
],
"routes": [
{
"custom_domain": true,
"pattern": "your.route.here"
}
],
"dev": {
"port": 3003
},
"placement": {
"mode": "smart"
}
}

View File

@@ -14,7 +14,7 @@ export default class EmailWorker extends WorkerEntrypoint {
const msg = createMimeMessage(); const msg = createMimeMessage();
msg.setSender({ msg.setSender({
name: "New Website Contact", name: "New Website Contact",
addr: "contact@seemueller.io", addr: "contact@example.com",
}); });
console.log("Recipient:", to); console.log("Recipient:", to);
// msg.setRecipient(to); // msg.setRecipient(to);
@@ -27,8 +27,8 @@ export default class EmailWorker extends WorkerEntrypoint {
try { try {
const message = new EmailMessage( const message = new EmailMessage(
"contact@seemueller.io", "contact@example.com",
"geoff@seemueller.io", "team@example.com",
msg.asRaw(), msg.asRaw(),
); );
await this.env.SEB.send(message); await this.env.SEB.send(message);

View File

@@ -1,14 +0,0 @@
main="email_worker.js"
name = "email-service-rpc"
compatibility_date = "2024-12-20"
node_compat = true
[dev]
port = 3002
[placement]
mode = "smart"
send_email = [
{name = "SEB", destination_address = "contact@seemueller.io"},
]

View File

@@ -0,0 +1,18 @@
{
"compatibility_date": "2025-05-27",
"main": "email_worker.js",
"name": "email-service-rpc",
"node_compat": true,
"dev": {
"port": 3002
},
"placement": {
"mode": "smart",
"send_email": [
{
"destination_address": "contact@example.com",
"name": "SEB"
}
]
}
}