add TODO planning

This commit is contained in:
2024-10-14 18:50:59 -05:00
parent 829e1f34dc
commit 953d3738b1
3 changed files with 14 additions and 2 deletions

View File

@@ -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. - Newer or older may work, but is untested.
- [pnpm][pnpm] - [pnpm][pnpm]
- Cloudflare API Token - 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]. - Create one [here][cf-token].
- The domain you want to onboard, managed by Cloudflare. - The domain you want to onboard, managed by Cloudflare.
<!-- TODO: Test Node.js versions -->
<!-- TODO: Test minimum permission requirements -->
## Usage ## Usage
1. Clone the repository 1. Clone the repository

View File

@@ -1,7 +1,7 @@
{ {
"name": "fastmail-cloudflare", "name": "fastmail-cloudflare",
"version": "0.0.1", "version": "0.0.1",
"description": "Quickly setup Fastmail with Cloudflare", "description": "Rapidly onboard a new Cloudflare-managed domain with FastMail ",
"scripts": { "scripts": {
"start": "tsx src/index.ts" "start": "tsx src/index.ts"
}, },

View File

@@ -8,6 +8,8 @@ const cloudflare = new Cloudflare({
apiToken: process.env.CLOUDFLARE_API_TOKEN, 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 targetZone = process.env.TARGET_ZONE_ID!;
const commentTag = `${packageJson.name} v${packageJson.version}`; const commentTag = `${packageJson.name} v${packageJson.version}`;
@@ -209,6 +211,12 @@ async function handleSpfRecords() {
} }
async function main() { 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 target zone is not provided, list all zones with name + id
if (!targetZone) { if (!targetZone) {
const response = await cloudflare.zones.list({ per_page: 2 }); const response = await cloudflare.zones.list({ per_page: 2 });