Updated code generation tool

- Module rename to acmedns
This commit is contained in:
Toby Chui
2024-05-10 20:02:39 +08:00
parent 1d63b679dc
commit 55bc939a37
5 changed files with 34 additions and 94 deletions

View File

@@ -10,9 +10,12 @@ import (
)
var legoProvidersSourceFolder string = "./lego/providers/dns/"
var outputDir string = "./providersdef"
var defTemplate string = `package providerdef
var outputDir string = "./acmedns"
var defTemplate string = `package acmedns
/*
THIS MODULE IS GENERATED AUTOMATICALLY
DO NOT EDIT THIS FILE
*/
import (
"encoding/json"
"fmt"
@@ -22,7 +25,7 @@ import (
)
//name is the DNS provider name, e.g. cloudflare or gandi
//JSON (js) must be in key-value string, e.g. {"Username":"far","Password":"boo"}
//JSON (js) must be in key-value string that match ConfigableFields Title in providers.json, e.g. {"Username":"far","Password":"boo"}
func GetDNSProviderByJsonConfig(name string, js string)(challenge.Provider, error){
switch name {
{{magic}}
@@ -57,13 +60,15 @@ func fileExists(filePath string) bool {
// This function define the DNS not supported by zoraxy
func getExcludedDNSProviders() []string {
return []string{
"edgedns", //Too complex data structure
"exec", //Not a DNS provider
"httpreq", //Not a DNS provider
"hurricane", //Multi-credentials arch
"oraclecloud", //Evil company
"acmedns", //Not a DNS provider
"selectelv2", //Not sure why not working with our code generator
"edgedns", //Too complex data structure
"exec", //Not a DNS provider
"httpreq", //Not a DNS provider
"hurricane", //Multi-credentials arch
"oraclecloud", //Evil company
"acmedns", //Not a DNS provider
"selectelv2", //Not sure why not working with our code generator
"designate", //OpenStack, if you are using this you shd not be using zoraxy
"mythicbeasts", //Module require url.URL, which cannot be automatically parsed
}
}
@@ -230,6 +235,6 @@ func main() {
fullCodeSnippet := strings.ReplaceAll(defTemplate, "{{magic}}", generatedConvertcode)
fullCodeSnippet = strings.ReplaceAll(fullCodeSnippet, "{{imports}}", importList)
os.WriteFile(filepath.Join(outputDir, "providersdef.go"), []byte(fullCodeSnippet), 0775)
os.WriteFile(filepath.Join(outputDir, "acmedns.go"), []byte(fullCodeSnippet), 0775)
fmt.Println("Output written to file")
}