diff --git a/farm-aggregator/.env.example b/farm-aggregator/.env.example new file mode 100644 index 0000000..ebda057 --- /dev/null +++ b/farm-aggregator/.env.example @@ -0,0 +1,32 @@ +# Anthropic +ANTHROPIC_API_KEY=sk-ant-... + +# AG-Refine (your Render deployment) +AGREFINE_API_URL=https://ag-refine.onrender.com/api +AGREFINE_API_KEY= + +# Dropbox (OAuth2 long-lived refresh token — see README for setup) +DROPBOX_APP_KEY= +DROPBOX_APP_SECRET= +DROPBOX_REFRESH_TOKEN= + +# Dropbox folder paths (shared folders on your account) +DROPBOX_INBOX_PATH=/Farm/Inbox +DROPBOX_OUTBOX_PATH=/Farm/Summaries +DROPBOX_DAIRYCOMP_PATH=/Farm/DairyComp +DROPBOX_FEEDLYNC_PATH=/Farm/FeedLync + +# WhatsApp Business API (Meta) +# Leave blank to disable — summaries go to Dropbox only +WHATSAPP_ACCESS_TOKEN= +WHATSAPP_PHONE_ID= +WHATSAPP_RECIPIENT=+1... + +# TomTom (geofence webhooks received on this port) +TOMTOM_API_KEY=wvJd...kqf0 +WEBHOOK_PORT=3001 + +# Schedule (cron syntax) +PULSE_SCHEDULE=0 * * * * # hourly pulse +DAILY_SCHEDULE=0 6 * * * # 06:00 daily digest +WEEKLY_SCHEDULE=0 6 * * 1 # Monday 06:00 weekly report diff --git a/farm-aggregator/.gitignore b/farm-aggregator/.gitignore new file mode 100644 index 0000000..2d7ec5c --- /dev/null +++ b/farm-aggregator/.gitignore @@ -0,0 +1,2 @@ +.env +node_modules/ diff --git a/farm-aggregator/config.js b/farm-aggregator/config.js index 282c26b..ccc59e8 100644 --- a/farm-aggregator/config.js +++ b/farm-aggregator/config.js @@ -31,7 +31,7 @@ export const config = { apiKey: process.env.TOMTOM_API_KEY ?? '', }, server: { - port: parseInt(process.env.WEBHOOK_PORT ?? '3001', 10), + port: parseInt(process.env.PORT ?? process.env.WEBHOOK_PORT ?? '3001', 10), }, schedule: { pulse: process.env.PULSE_SCHEDULE ?? '0 * * * *', diff --git a/farm-aggregator/render.yaml b/farm-aggregator/render.yaml new file mode 100644 index 0000000..7338144 --- /dev/null +++ b/farm-aggregator/render.yaml @@ -0,0 +1,45 @@ +services: + - type: web + name: farm-aggregator + runtime: node + rootDir: farm-aggregator + buildCommand: npm install + startCommand: node index.js + plan: starter + envVars: + - key: NODE_ENV + value: production + - key: ANTHROPIC_API_KEY + sync: false + - key: AGREFINE_API_URL + value: https://ag-refine.onrender.com/api + - key: AGREFINE_API_KEY + sync: false + - key: DROPBOX_APP_KEY + sync: false + - key: DROPBOX_APP_SECRET + sync: false + - key: DROPBOX_REFRESH_TOKEN + sync: false + - key: DROPBOX_INBOX_PATH + value: /Farm/Inbox + - key: DROPBOX_OUTBOX_PATH + value: /Farm/Summaries + - key: DROPBOX_DAIRYCOMP_PATH + value: /Farm/DairyComp + - key: DROPBOX_FEEDLYNC_PATH + value: /Farm/FeedLync + - key: WHATSAPP_ACCESS_TOKEN + sync: false + - key: WHATSAPP_PHONE_ID + sync: false + - key: WHATSAPP_RECIPIENT + sync: false + - key: TOMTOM_API_KEY + sync: false + - key: PULSE_SCHEDULE + value: "0 * * * *" + - key: DAILY_SCHEDULE + value: "0 6 * * *" + - key: WEEKLY_SCHEDULE + value: "0 6 * * 1"