mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-30 09:57:51 +01:00
Moved v3 code from NginxProxyManager/nginx-proxy-manager-3 to NginxProxyManager/nginx-proxy-manager
This commit is contained in:
1 parent
4db34f5894
commit
2110ecc382
830 files changed
+38168
-36635
No files matched your search
@@ -0,0 +1,51 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"npm/internal/dnsproviders"
|
||||
"npm/internal/util"
|
||||
)
|
||||
|
||||
// CreateDNSProvider is the schema for incoming data validation
|
||||
func CreateDNSProvider() string {
|
||||
allProviders := dnsproviders.GetAll()
|
||||
fmtStr := fmt.Sprintf(`{"oneOf": [%s]}`, strings.TrimRight(strings.Repeat("\n%s,", len(allProviders)), ","))
|
||||
|
||||
allSchemasWrapped := make([]string, 0)
|
||||
for providerName, provider := range allProviders {
|
||||
allSchemasWrapped = append(allSchemasWrapped, createDNSProviderType(providerName, provider.Schema))
|
||||
}
|
||||
|
||||
return fmt.Sprintf(fmtStr, util.ConvertStringSliceToInterface(allSchemasWrapped)...)
|
||||
}
|
||||
|
||||
func createDNSProviderType(name, metaSchema string) string {
|
||||
return fmt.Sprintf(`
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"acmesh_name",
|
||||
"name",
|
||||
"meta"
|
||||
],
|
||||
"properties": {
|
||||
"acmesh_name": {
|
||||
"type": "string",
|
||||
"pattern": "^%s$"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"maxLength": 100
|
||||
},
|
||||
"dns_sleep": {
|
||||
"type": "integer"
|
||||
},
|
||||
"meta": %s
|
||||
}
|
||||
}
|
||||
`, name, metaSchema)
|
||||
}
|
||||
Reference in new issue
Block a user