Enhance CloudflareAdapter with additional properties and improve DNS record handling
- Updated CloudflareAdapter to include hostname and path in routes data structure. - Added validation to ensure only records with an ID are pushed to relationships. - Minor adjustments to documentation by removing outdated project status link.
This commit is contained in:
@@ -486,7 +486,7 @@ export class CloudflareAdapter implements InfrastructureAdapter {
|
||||
)
|
||||
|
||||
if (routesResponse.ok) {
|
||||
const routesData = (await routesResponse.json()) as { result?: Array<{ zone_id?: string }> }
|
||||
const routesData = (await routesResponse.json()) as { result?: Array<{ zone_id?: string, hostname?: string, path?: string }> }
|
||||
const routes = routesData.result || []
|
||||
|
||||
for (const route of routes) {
|
||||
@@ -523,20 +523,22 @@ export class CloudflareAdapter implements InfrastructureAdapter {
|
||||
)
|
||||
|
||||
if (dnsResponse.ok) {
|
||||
const dnsData = await dnsResponse.json()
|
||||
const dnsData = (await dnsResponse.json()) as { result?: Array<{ id?: string, type?: string, name?: string, content?: string }> }
|
||||
const records = dnsData.result || []
|
||||
|
||||
for (const record of records) {
|
||||
relationships.push({
|
||||
sourceId: providerId,
|
||||
targetId: record.id,
|
||||
type: 'contains',
|
||||
metadata: {
|
||||
type: record.type,
|
||||
name: record.name,
|
||||
content: record.content,
|
||||
},
|
||||
})
|
||||
if (record.id) {
|
||||
relationships.push({
|
||||
sourceId: providerId,
|
||||
targetId: record.id,
|
||||
type: 'contains',
|
||||
metadata: {
|
||||
type: record.type,
|
||||
name: record.name,
|
||||
content: record.content,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,7 +558,7 @@ export class CloudflareAdapter implements InfrastructureAdapter {
|
||||
)
|
||||
|
||||
if (routesResponse.ok) {
|
||||
const routesData = (await routesResponse.json()) as { result?: Array<{ zone_id?: string }> }
|
||||
const routesData = (await routesResponse.json()) as { result?: Array<{ zone_id?: string, hostname?: string }> }
|
||||
const routes = routesData.result || []
|
||||
|
||||
for (const route of routes) {
|
||||
|
||||
Reference in New Issue
Block a user