feat: Added Netlify as a provider. - #1052
Conversation
…: updates aren't supported so we have to delete and then recreate). Passes linting though I did have to migrate the lint config to get it to run but those changes are not included in this commit.
|
|
||
| 2. Navigate to **Site settings** for your site | ||
|
|
||
| 3. Go to **Domain management** → **DNS zones** | ||
|
|
||
| 4. Ensure your domain is properly configured as a DNS zone in Netlify |
There was a problem hiding this comment.
nit let's use 1. everywhere so github markdown handles the numbering
| 2. Navigate to **Site settings** for your site | |
| 3. Go to **Domain management** → **DNS zones** | |
| 4. Ensure your domain is properly configured as a DNS zone in Netlify | |
| 1. Navigate to **Site settings** for your site | |
| 1. Go to **Domain management** → **DNS zones** | |
| 1. Ensure your domain is properly configured as a DNS zone in Netlify |
|
|
||
| ## Token setup | ||
|
|
There was a problem hiding this comment.
let's just continue directly to the token setup
| ## Token setup |
|
|
||
| 2. Click **New access token** | ||
|
|
||
| 3. Give the token a descriptive name (e.g., "DDNS Updater") | ||
|
|
||
| 4. Select the following scopes: | ||
| - **DNS:read** - Read DNS zones and records | ||
| - **DNS:edit** - Edit DNS zones and records | ||
|
|
||
| 5. Click **Generate token** | ||
|
|
||
| 6. Copy the generated token - this is your `"token"` value |
There was a problem hiding this comment.
| 2. Click **New access token** | |
| 3. Give the token a descriptive name (e.g., "DDNS Updater") | |
| 4. Select the following scopes: | |
| - **DNS:read** - Read DNS zones and records | |
| - **DNS:edit** - Edit DNS zones and records | |
| 5. Click **Generate token** | |
| 6. Copy the generated token - this is your `"token"` value | |
| 1. Click **New access token** | |
| 1. Give the token a descriptive name (e.g., "DDNS Updater") | |
| 1. Select the following scopes: | |
| - **DNS:read** - Read DNS zones and records | |
| - **DNS:edit** - Edit DNS zones and records | |
| 1. Click **Generate token** - this is your `"token"` value |
| ## Testing | ||
|
|
||
| 1. Go to your Netlify site's DNS management page | ||
|
|
||
| 2. Check the current DNS record for your domain | ||
|
|
||
| 3. Run ddns-updater | ||
|
|
||
| 4. Refresh the Netlify DNS page to verify the update occurred |
There was a problem hiding this comment.
I appreciate the effort in documentation, but let's remove this section, I don't think it's really necessary. ddns-updater should log if anything wrong happens.
| ## Testing | |
| 1. Go to your Netlify site's DNS management page | |
| 2. Check the current DNS record for your domain | |
| 3. Run ddns-updater | |
| 4. Refresh the Netlify DNS page to verify the update occurred |
|
|
||
| ## Notes | ||
|
|
||
| - Netlify's DNS API requires the domain to be configured as a DNS zone in your Netlify account |
There was a problem hiding this comment.
this is already mentioned in the domain setup section
| - Netlify's DNS API requires the domain to be configured as a DNS zone in your Netlify account |
| record, err := p.getDNSRecord(ctx, zoneID, recordID) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to get existing DNS record: %w", err) | ||
| } |
There was a problem hiding this comment.
do we need to get the record information only to have record.Hostname? Can't we build it locally without doing a request?
It feels like getDNSRecord could be removed
| Priority int64 `json:"priority,omitempty"` | ||
| Weight int64 `json:"weight,omitempty"` | ||
| Port int64 `json:"port,omitempty"` | ||
| Flag int64 `json:"flag,omitempty"` | ||
| Tag string `json:"tag,omitempty"` |
There was a problem hiding this comment.
unused so remove them
| Priority int64 `json:"priority,omitempty"` | |
| Weight int64 `json:"weight,omitempty"` | |
| Port int64 `json:"port,omitempty"` | |
| Flag int64 `json:"flag,omitempty"` | |
| Tag string `json:"tag,omitempty"` |
| Type string `json:"type"` | ||
| Hostname string `json:"hostname"` | ||
| Value string `json:"value"` | ||
| TTL int64 `json:"ttl"` |
There was a problem hiding this comment.
what happens if we leave this empty
| TTL int64 `json:"ttl"` | |
| TTL int64 `json:"ttl,omitempty"` |
does netlify set a default ttl on their own? That might be more appropriate than having a hardcoded default ttl in ddns-updater
| } | ||
|
|
||
| // DNS record creation structure. | ||
| type dnsRecordCreate struct { |
There was a problem hiding this comment.
since this is used in only one place, I would recommend declaring this type where it's used inside the method instead of at global scope.
| } | ||
|
|
||
| // DNS record structure. | ||
| type dnsRecord struct { |
There was a problem hiding this comment.
since this will be used in only one place, I would recommend declaring this type where it's used inside the method instead of at global scope. You can also remove all fields except ID as far as I recall, other fields are not used.
Added the provider (note…updates aren't supported so we have to delete and then recreate)., created documentation for it and updated the readme. Passes linting though I did have to migrate the lint config to get it to run but those changes are not included in this commit.