68 lines
1.5 KiB
Markdown
68 lines
1.5 KiB
Markdown
# Cloudflare DNS Module
|
|
|
|
Declarative DNS management for Cloudflare using `flarectl`.
|
|
|
|
## Usage
|
|
|
|
Add to your host configuration:
|
|
```nix
|
|
{
|
|
imports = [
|
|
../../modules/cloudflare-dns
|
|
];
|
|
|
|
cloudflare-dns = {
|
|
enable = true;
|
|
apiToken = "YOUR_CLOUDFLARE_API_TOKEN";
|
|
zoneId = "YOUR_ZONE_ID";
|
|
|
|
records = [
|
|
{
|
|
name = "uptime";
|
|
type = "A";
|
|
content = "YOUR_SERVER_IP";
|
|
proxied = true;
|
|
}
|
|
{
|
|
name = "monitoring";
|
|
type = "CNAME";
|
|
content = "uptime.example.com";
|
|
proxied = true;
|
|
}
|
|
];
|
|
};
|
|
}
|
|
```
|
|
|
|
## Getting Your API Token
|
|
|
|
1. Go to https://dash.cloudflare.com/profile/api-tokens
|
|
2. Click "Create Token"
|
|
3. Use "Edit zone DNS" template
|
|
4. Select your zone (domain)
|
|
5. Copy the token
|
|
|
|
## Getting Your Zone ID
|
|
|
|
1. Go to https://dash.cloudflare.com
|
|
2. Click on your domain
|
|
3. Look for "Zone ID" on the right sidebar
|
|
4. Copy the ID
|
|
|
|
## Options
|
|
|
|
- `apiToken` - Cloudflare API token (required)
|
|
- `zoneId` - Cloudflare zone ID (required)
|
|
- `records` - List of DNS records to manage
|
|
- `name` - Record name (e.g., "uptime" for uptime.example.com)
|
|
- `type` - Record type (A, AAAA, CNAME, etc., default: A)
|
|
- `content` - Record content (IP address, hostname, etc.)
|
|
- `proxied` - Use Cloudflare proxy (default: true)
|
|
- `ttl` - TTL value (1 = auto, default: 1)
|
|
|
|
## Usage Notes
|
|
|
|
- Records are updated on system activation
|
|
- Use `sudo systemctl start cloudflare-dns-update` to manually update
|
|
- API token should be stored securely (consider using sops-nix)
|