fix schemas

This commit is contained in:
yusing 2025-01-05 15:03:03 +08:00
parent ef3dbc217b
commit 6034908a95
3 changed files with 47 additions and 188 deletions

View file

@ -1,10 +1,10 @@
{ {
"yaml.schemas": { "yaml.schemas": {
"https://github.com/yusing/go-proxy/raw/main/schema/config.schema.json": [ "https://github.com/yusing/go-proxy/raw/v0.8/schema/config.schema.json": [
"config.example.yml", "config.example.yml",
"config.yml" "config.yml"
], ],
"https://github.com/yusing/go-proxy/raw/main/schema/providers.schema.json": [ "https://github.com/yusing/go-proxy/raw/v0.8/schema/providers.schema.json": [
"providers.example.yml" "providers.example.yml"
] ]
} }

View file

@ -1,4 +1,5 @@
{ {
"$id": "https://github.com/yusing/go-proxy/raw/v0.8/schema/config.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"type": "object", "type": "object",
"title": "GoDoxy config file", "title": "GoDoxy config file",
@ -10,8 +11,7 @@
"email": { "email": {
"title": "ACME Email", "title": "ACME Email",
"type": "string", "type": "string",
"pattern": "^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}$", "format": "email"
"patternErrorMessage": "Invalid email"
}, },
"domains": { "domains": {
"title": "Cert Domains", "title": "Cert Domains",
@ -24,7 +24,7 @@
"cert_path": { "cert_path": {
"title": "path of cert file to load/store", "title": "path of cert file to load/store",
"default": "certs/cert.crt", "default": "certs/cert.crt",
"markdownDescription": "default: `certs/cert.crt`", "markdownDescription": "default: `certs/cert.crt`,",
"type": "string" "type": "string"
}, },
"key_path": { "key_path": {
@ -447,156 +447,7 @@
} }
}, },
"access_log": { "access_log": {
"title": "Access log configuration", "$ref": "https://github.com/yusing/go-proxy/raw/v0.8/schema/access_log.json"
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"title": "Access log path",
"type": "string"
},
"format": {
"title": "Access log format",
"type": "string",
"enum": [
"common",
"combined",
"json"
]
},
"buffer_size": {
"title": "Access log buffer size in bytes",
"type": "integer",
"minimum": 1
},
"filters": {
"title": "Access log filters",
"type": "object",
"additionalProperties": false,
"properties": {
"cidr": {
"title": "CIDR filter",
"type": "object",
"additionalProperties": false,
"properties": {
"negative": {
"type": "boolean"
},
"values": {
"type": "array"
}
}
},
"status_codes": {
"title": "Status code filter",
"type": "object",
"additionalProperties": false,
"properties": {
"negative": {
"type": "boolean"
},
"values": {
"type": "array"
}
}
},
"method": {
"title": "Method filter",
"type": "object",
"additionalProperties": false,
"properties": {
"negative": {
"type": "boolean"
},
"values": {
"type": "array"
}
}
},
"headers": {
"title": "Header filter",
"type": "object",
"additionalProperties": false,
"properties": {
"negative": {
"type": "boolean"
},
"values": {
"type": "array"
}
}
},
"host": {
"title": "Host filter",
"type": "object",
"additionalProperties": false,
"properties": {
"negative": {
"type": "boolean"
},
"values": {
"type": "array"
}
}
}
}
},
"fields": {
"title": "Access log fields",
"type": "object",
"additionalProperties": false,
"properties": {
"headers": {
"type": "object",
"additionalProperties": false,
"properties": {
"default": {
"enum": [
"keep",
"redact",
"drop"
]
},
"config": {
"type": "object"
}
}
},
"query": {
"type": "object",
"additionalProperties": false,
"properties": {
"default": {
"enum": [
"keep",
"redact",
"drop"
]
},
"config": {
"type": "object"
}
}
},
"cookies": {
"type": "object",
"additionalProperties": false,
"properties": {
"default": {
"enum": [
"keep",
"redact",
"drop"
]
},
"config": {
"type": "object"
}
}
}
}
}
}
} }
} }
}, },

View file

@ -1,4 +1,5 @@
{ {
"$id": "https://github.com/yusing/go-proxy/raw/v0.8/schema/providers.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"title": "GoDoxy standalone include file", "title": "GoDoxy standalone include file",
"oneOf": [ "oneOf": [
@ -15,7 +16,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"scheme": { "scheme": {
"title": "Proxy scheme (http, https, tcp, udp)", "title": "Proxy scheme",
"oneOf": [ "oneOf": [
{ {
"type": "string", "type": "string",
@ -38,28 +39,28 @@
}, },
"host": { "host": {
"default": "localhost", "default": "localhost",
"oneOf": [ "anyOf": [
{ {
"type": "null", "type": "null",
"description": "localhost (default)" "title": "localhost (default)"
}, },
{ {
"type": "string", "type": "string",
"format": "ipv4", "format": "ipv4",
"description": "Proxy to ipv4 address" "title": "ipv4 address"
}, },
{ {
"type": "string", "type": "string",
"format": "ipv6", "format": "ipv6",
"description": "Proxy to ipv6 address" "title": "ipv6 address"
}, },
{ {
"type": "string", "type": "string",
"format": "hostname", "format": "hostname",
"description": "Proxy to hostname" "title": "hostname"
} }
], ],
"title": "Proxy host (ipv4 / ipv6 / hostname)" "title": "Proxy host (ipv4/6 / hostname)"
}, },
"port": {}, "port": {},
"no_tls_verify": {}, "no_tls_verify": {},
@ -71,48 +72,49 @@
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"show": { "show": {
"description": "Show on dashboard", "title": "Show on dashboard",
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
"name": { "name": {
"description": "Display name", "title": "Display name",
"type": "string" "type": "string"
}, },
"icon": { "icon": {
"description": "Display icon", "title": "Display icon",
"type": "string", "type": "string",
"oneOf": [ "oneOf": [
{ {
"pattern": "^(png|svg)\\/[\\w\\d-_]+\\.(png|svg)$", "pattern": "^(png|svg)\\/[\\w\\d\\-_]+\\.\\1$",
"description": "Icon from walkxcode/dashboard-icons", "title": "Icon from walkxcode/dashboard-icons"
"errorMessage": "must be png/filename.png or svg/filename.svg"
}, },
{ {
"pattern": "^https?://", "pattern": "^https?://",
"description": "Absolute URI" "title": "Absolute URI",
"format": "uri"
}, },
{ {
"pattern": "^@target/", "pattern": "^@target/",
"description": "Relative URI to target" "title": "Relative URI to target"
} }
] ]
}, },
"url": { "url": {
"description": "App URL override", "title": "App URL override",
"type": "string", "type": "string",
"format": "uri" "format": "uri",
"pattern": "^https?://"
}, },
"category": { "category": {
"description": "Category", "title": "Category",
"type": "string" "type": "string"
}, },
"description": { "description": {
"description": "Description", "title": "Description",
"type": "string" "type": "string"
}, },
"widget_config": { "widget_config": {
"description": "Widget config", "title": "Widget config",
"type": "object" "type": "object"
} }
} }
@ -122,7 +124,7 @@
"properties": { "properties": {
"link": { "link": {
"type": "string", "type": "string",
"description": "Name and subdomain of load-balancer" "title": "Name and subdomain of load-balancer"
}, },
"mode": { "mode": {
"enum": [ "enum": [
@ -130,18 +132,18 @@
"least_conn", "least_conn",
"ip_hash" "ip_hash"
], ],
"description": "Load-balance mode", "title": "Load-balance mode",
"default": "roundrobin" "default": "roundrobin"
}, },
"weight": { "weight": {
"type": "integer", "type": "integer",
"description": "Reserved for future use", "title": "Reserved for future use",
"minimum": 0, "minimum": 0,
"maximum": 100 "maximum": 100
}, },
"options": { "options": {
"type": "object", "type": "object",
"description": "load-balance mode specific options" "title": "load-balance mode specific options"
} }
} }
}, },
@ -150,26 +152,32 @@
"properties": { "properties": {
"disable": { "disable": {
"type": "boolean", "type": "boolean",
"default": false "default": false,
"title": "Disable healthcheck"
}, },
"path": { "path": {
"type": "string", "type": "string",
"description": "Healthcheck path", "title": "Healthcheck path",
"default": "/", "default": "/",
"format": "uri" "format": "uri-reference",
"description": "should start with `/`"
}, },
"use_get": { "use_get": {
"type": "boolean", "type": "boolean",
"description": "Use GET instead of HEAD", "title": "Use GET instead of HEAD",
"default": false "default": false
}, },
"interval": { "interval": {
"type": "string", "type": "string",
"description": "Interval for healthcheck (e.g. 5s, 1h25m30s)", "title": "healthcheck Interval",
"pattern": "^([0-9]+(ms|s|m|h))+$", "pattern": "^([0-9]+(ms|s|m|h))+$",
"default": "5s" "default": "5s",
"description": "e.g. 5s, 1m, 2h, 3m30s"
} }
} }
},
"access_log": {
"$ref": "https://github.com/yusing/go-proxy/raw/v0.8/schema/access_log.json"
} }
}, },
"additionalProperties": false, "additionalProperties": false,
@ -216,7 +224,7 @@
"markdownDescription": "A list of [path patterns](https://pkg.go.dev/net/http#hdr-Patterns-ServeMux)", "markdownDescription": "A list of [path patterns](https://pkg.go.dev/net/http#hdr-Patterns-ServeMux)",
"items": { "items": {
"type": "string", "type": "string",
"pattern": "^((GET|POST|DELETE|PUT|PATCH|HEAD|OPTIONS|CONNECT)\\s)?(/(\\w*|{\\w*}|{\\$}))+/?$", "pattern": "^(?:([A-Z]+) )?(?:([a-zA-Z0-9.-]+)\\/)?(\\/[^\\s]*)$",
"patternErrorMessage": "invalid path pattern" "patternErrorMessage": "invalid path pattern"
} }
}, },
@ -236,7 +244,7 @@
"port": { "port": {
"markdownDescription": "`listening port:proxy port` or `listening port:service name`", "markdownDescription": "`listening port:proxy port` or `listening port:service name`",
"type": "string", "type": "string",
"pattern": "^[0-9]+\\:[0-9a-z]+$", "pattern": "^[0-9]+:[0-9a-z]+$",
"patternErrorMessage": "invalid syntax" "patternErrorMessage": "invalid syntax"
}, },
"no_tls_verify": { "no_tls_verify": {
@ -265,7 +273,7 @@
"then": { "then": {
"properties": { "properties": {
"no_tls_verify": { "no_tls_verify": {
"description": "Disable TLS verification for https proxy", "title": "Disable TLS verification for https proxy",
"type": "boolean", "type": "boolean",
"default": false "default": false
} }