From 08d52024abc91e0236996e08f82e3d6eb6bd26e1 Mon Sep 17 00:00:00 2001 From: Toby Chui Date: Mon, 20 May 2024 21:53:53 +0800 Subject: [PATCH] Fixed bug in generator Fixed bug for acmedns module auto generation for ovh provider #161 --- tools/dns_challenge_update/code-gen/extract.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/dns_challenge_update/code-gen/extract.go b/tools/dns_challenge_update/code-gen/extract.go index ebf4f5b..e507f12 100644 --- a/tools/dns_challenge_update/code-gen/extract.go +++ b/tools/dns_challenge_update/code-gen/extract.go @@ -132,6 +132,23 @@ func extractConfigStruct(sourceCode string) (string, string) { // Extract the struct name and its content. structName := match[1] structContent := match[2] + if structName != "Config" { + allStructs := structRegex.FindAllStringSubmatch(sourceCode, 10) + for _, thisStruct := range allStructs { + //fmt.Println("Name => ", test[1]) + //fmt.Println("Content => ", test[2]) + + if thisStruct[1] == "Config" { + structName = "Config" + structContent = thisStruct[2] + break + } + } + + if structName != "Config" { + panic("Unable to find Config for this provider") + } + } return structName, structContent }