mirror of
https://github.com/dalbodeule/sh0rt.kr-pdns.git
synced 2025-06-08 18:58:20 +00:00
fix pdns api clients (retry 2x)
This commit is contained in:
parent
46967bbe6b
commit
bbe4b93b89
@ -15,6 +15,9 @@ class PowerDNSApiClient {
|
||||
@Value("\${pdns.api.key}")
|
||||
private lateinit var apiKey: String
|
||||
|
||||
@Value("\${pdns.ns}")
|
||||
private lateinit var ns: String
|
||||
|
||||
private val restTemplate = RestTemplate()
|
||||
private val gson = Gson()
|
||||
|
||||
@ -28,7 +31,7 @@ class PowerDNSApiClient {
|
||||
fun createDomain(name: String): ResponseEntity<String> {
|
||||
val url = "$apiUrl/api/v1/servers/localhost/zones"
|
||||
val headers = createHeaders()
|
||||
val domainRequest = DomainRequest("$name.", "Master", arrayOf(), arrayOf())
|
||||
val domainRequest = DomainRequest("$name.", "Native", arrayOf(), ns.split(",").toTypedArray())
|
||||
val body = gson.toJson(domainRequest)
|
||||
val entity = HttpEntity(body, headers)
|
||||
return restTemplate.exchange(url, HttpMethod.POST, entity, String::class.java)
|
||||
|
@ -11,6 +11,6 @@ springdoc.swagger-ui.enabled=false
|
||||
springdoc.api-docs.path=/api-docs
|
||||
springdoc.default-consumes-media-type= application/json
|
||||
springdoc.default-produces-media-type= application/json
|
||||
springdoc.version= '@project.version@'
|
||||
pdns.api.key=${PDNS_API_KEY}
|
||||
pdns.api.url=${PDNS_API_URL}
|
||||
pdns.ns=${PDNS_NS}
|
Loading…
x
Reference in New Issue
Block a user