GoDoxy/schema/providers.schema.json
2024-11-04 00:06:59 +08:00

286 lines
No EOL
7.8 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "GoDoxy standalone include file",
"oneOf": [
{
"type": "object"
},
{
"type": "null"
}
],
"patternProperties": {
"^[a-zA-Z0-9_-]+$": {
"title": "Proxy entry",
"type": "object",
"properties": {
"scheme": {
"title": "Proxy scheme (http, https, tcp, udp)",
"oneOf": [
{
"type": "string",
"enum": [
"http",
"https",
"tcp",
"udp",
"tcp:tcp",
"udp:udp",
"tcp:udp",
"udp:tcp"
]
},
{
"type": "null",
"description": "Auto detect base on port format"
}
]
},
"host": {
"default": "localhost",
"oneOf": [
{
"type": "null",
"description": "localhost (default)"
},
{
"type": "string",
"format": "ipv4",
"description": "Proxy to ipv4 address"
},
{
"type": "string",
"format": "ipv6",
"description": "Proxy to ipv6 address"
},
{
"type": "string",
"format": "hostname",
"description": "Proxy to hostname"
}
],
"title": "Proxy host (ipv4 / ipv6 / hostname)"
},
"port": {},
"no_tls_verify": {},
"path_patterns": {},
"middlewares": {},
"homepage": {
"title": "Dashboard config",
"type": "object",
"additionalProperties": false,
"properties": {
"show": {
"description": "Show on dashboard",
"type": "boolean",
"default": true
},
"name": {
"description": "Display name",
"type": "string"
},
"icon": {
"description": "Display icon",
"type": "string",
"oneOf": [
{
"pattern": "^(png|svg)\\/[\\w\\d-_]+\\.(png|svg)$",
"description": "Icon from walkxcode/dashboard-icons",
"errorMessage": "must be png/filename.png or svg/filename.svg"
},
{
"pattern": "^https?://",
"description": "Absolute URI"
},
{
"pattern": "^@target/",
"description": "Relative URI to target"
}
]
},
"url": {
"description": "App URL override",
"type": "string",
"format": "uri"
},
"category": {
"description": "Category",
"type": "string"
},
"description": {
"description": "Description",
"type": "string"
},
"widget_config": {
"description": "Widget config",
"type": "object"
}
}
},
"load_balance": {
"type": "object",
"properties": {
"link": {
"type": "string",
"description": "Name and subdomain of load-balancer"
},
"mode": {
"enum": [
"round_robin",
"least_conn",
"ip_hash"
],
"description": "Load-balance mode",
"default": "roundrobin"
},
"weight": {
"type": "integer",
"description": "Reserved for future use",
"minimum": 0,
"maximum": 100
},
"options": {
"type": "object",
"description": "load-balance mode specific options"
}
}
},
"healthcheck": {
"type": "object",
"properties": {
"disable": {
"type": "boolean",
"default": false
},
"path": {
"type": "string",
"description": "Healthcheck path",
"default": "/",
"format": "uri"
},
"use_get": {
"type": "boolean",
"description": "Use GET instead of HEAD",
"default": false
},
"interval": {
"type": "string",
"description": "Interval for healthcheck (e.g. 5s, 1h25m30s)",
"pattern": "^([0-9]+(ms|s|m|h))+$",
"default": "5s"
}
}
}
},
"additionalProperties": false,
"allOf": [
{
"if": {
"properties": {
"scheme": {
"anyOf": [
{
"enum": [
"http",
"https"
]
},
{
"type": "null"
}
]
}
}
},
"then": {
"properties": {
"port": {
"markdownDescription": "Proxy port from **0** to **65535**",
"oneOf": [
{
"type": "string",
"pattern": "^\\d{1,5}$",
"patternErrorMessage": "`port` must be a number"
},
{
"type": "integer",
"minimum": 0,
"maximum": 65535
}
]
},
"path_patterns": {
"oneOf": [
{
"type": "array",
"markdownDescription": "A list of [path patterns](https://pkg.go.dev/net/http#hdr-Patterns-ServeMux)",
"items": {
"type": "string",
"pattern": "^((GET|POST|DELETE|PUT|PATCH|HEAD|OPTIONS|CONNECT)\\s)?(/(\\w*|{\\w*}|{\\$}))+/?$",
"patternErrorMessage": "invalid path pattern"
}
},
{
"type": "null",
"description": "No proxy path"
}
]
},
"middlewares": {
"type": "object"
}
}
},
"else": {
"properties": {
"port": {
"markdownDescription": "`listening port:proxy port` or `listening port:service name`",
"type": "string",
"pattern": "^[0-9]+\\:[0-9a-z]+$",
"patternErrorMessage": "invalid syntax"
},
"no_tls_verify": {
"not": true
},
"path_patterns": {
"not": true
},
"middlewares": {
"not": true
}
},
"required": [
"port"
]
}
},
{
"if": {
"properties": {
"scheme": {
"const": "https"
}
}
},
"then": {
"properties": {
"no_tls_verify": {
"description": "Disable TLS verification for https proxy",
"type": "boolean",
"default": false
}
}
},
"else": {
"properties": {
"no_tls_verify": {
"not": true
}
}
}
}
]
}
},
"additionalProperties": false
}