From 953d3738b146b7d0892ecc6c62854f07939ed52e Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 14 Oct 2024 18:50:59 -0500 Subject: [PATCH] add TODO planning --- README.md | 6 +++++- package.json | 2 +- src/index.ts | 8 ++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index efe8c84..c8af7e6 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,14 @@ This is a simple script to update the DNS records of a domain in Cloudflare to p - Newer or older may work, but is untested. - [pnpm][pnpm] - Cloudflare API Token - - `DNS Settings:Edit` permission for the zone you want to onboard. + - `DNS Settings:Edit` permission. + - Ensure the token has access to the domain in question. - Create one [here][cf-token]. - The domain you want to onboard, managed by Cloudflare. + + + ## Usage 1. Clone the repository diff --git a/package.json b/package.json index af7859f..e7c9619 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fastmail-cloudflare", "version": "0.0.1", - "description": "Quickly setup Fastmail with Cloudflare", + "description": "Rapidly onboard a new Cloudflare-managed domain with FastMail ", "scripts": { "start": "tsx src/index.ts" }, diff --git a/src/index.ts b/src/index.ts index 2882dde..ac30f31 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,6 +8,8 @@ const cloudflare = new Cloudflare({ apiToken: process.env.CLOUDFLARE_API_TOKEN, }); +// TODO: Choose domain from the list of zones via prompt +// TODO: Verify the zone exists, confirm with user that the zone is correct. const targetZone = process.env.TARGET_ZONE_ID!; const commentTag = `${packageJson.name} v${packageJson.version}`; @@ -209,6 +211,12 @@ async function handleSpfRecords() { } async function main() { + // TODO: Environment variable validation, type checking + // TODO: Proper stdout/stderr logging, format, color + // TODO: Pre-run permission checks + // TODO: -y --confirm-all flag + // TODO: DMARC record (add, remove, delete, change) + doclink prompt, --dmarc flag + // If target zone is not provided, list all zones with name + id if (!targetZone) { const response = await cloudflare.zones.list({ per_page: 2 });