GoDoxy/schemas/config.schema.json
Yuzerion 589b3a7a13
Feat/auto schemas (#48)
* use auto generated schemas

* go version bump and dependencies upgrade

* clarify some error messages

---------

Co-authored-by: yusing <yusing@6uo.me>
2025-01-19 00:37:17 +08:00

1228 lines
45 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"definitions": {
"AccessLogFieldMode": {
"enum": [
"drop",
"keep",
"redact"
],
"type": "string"
},
"AccessLogFormat": {
"enum": [
"combined",
"common",
"json"
],
"type": "string"
},
"AutocertConfig": {
"anyOf": [
{
"$ref": "#/definitions/LocalOptions"
},
{
"$ref": "#/definitions/CloudflareOptions"
},
{
"$ref": "#/definitions/CloudDNSOptions"
},
{
"$ref": "#/definitions/DuckDNSOptions"
},
{
"$ref": "#/definitions/OVHOptionsWithAppKey"
},
{
"$ref": "#/definitions/OVHOptionsWithOAuth2Config"
}
]
},
"CIDR": {
"anyOf": [
{
"pattern": "^[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*$",
"type": "string"
},
{
"pattern": "^.*:.*:.*:.*:.*:.*:.*:.*$",
"type": "string"
},
{
"pattern": "^[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*/[0-9]*$",
"type": "string"
},
{
"pattern": "^::[0-9]*$",
"type": "string"
},
{
"pattern": "^.*::/[0-9]*$",
"type": "string"
},
{
"pattern": "^.*:.*::/[0-9]*$",
"type": "string"
}
]
},
"CloudDNSOptions": {
"additionalProperties": false,
"properties": {
"cert_path": {
"type": "string"
},
"domains": {
"items": {
"pattern": "^(\\*\\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$"
},
"type": "array"
},
"email": {
"format": "email",
"type": "string"
},
"key_path": {
"type": "string"
},
"options": {
"additionalProperties": false,
"properties": {
"client_id": {
"type": "string"
},
"email": {
"format": "email",
"type": "string"
},
"password": {
"type": "string"
}
},
"required": [
"client_id",
"email",
"password"
],
"type": "object"
},
"provider": {
"const": "clouddns",
"type": "string"
}
},
"required": [
"domains",
"email",
"options",
"provider"
],
"type": "object"
},
"CloudflareOptions": {
"additionalProperties": false,
"properties": {
"cert_path": {
"type": "string"
},
"domains": {
"items": {
"pattern": "^(\\*\\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$"
},
"type": "array"
},
"email": {
"format": "email",
"type": "string"
},
"key_path": {
"type": "string"
},
"options": {
"additionalProperties": false,
"properties": {
"auth_token": {
"type": "string"
}
},
"required": [
"auth_token"
],
"type": "object"
},
"provider": {
"const": "cloudflare",
"type": "string"
}
},
"required": [
"domains",
"email",
"options",
"provider"
],
"type": "object"
},
"DuckDNSOptions": {
"additionalProperties": false,
"properties": {
"cert_path": {
"type": "string"
},
"domains": {
"items": {
"pattern": "^(\\*\\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$"
},
"type": "array"
},
"email": {
"format": "email",
"type": "string"
},
"key_path": {
"type": "string"
},
"options": {
"additionalProperties": false,
"properties": {
"token": {
"type": "string"
}
},
"required": [
"token"
],
"type": "object"
},
"provider": {
"const": "duckdns",
"type": "string"
}
},
"required": [
"domains",
"email",
"options",
"provider"
],
"type": "object"
},
"GotifyConfig": {
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"provider": {
"const": "gotify",
"type": "string"
},
"token": {
"type": "string"
},
"url": {
"format": "uri",
"type": "string"
}
},
"required": [
"name",
"provider",
"token",
"url"
],
"type": "object"
},
"LocalOptions": {
"additionalProperties": false,
"properties": {
"cert_path": {
"type": "string"
},
"domains": {
"items": {
"pattern": "^(\\*\\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$"
},
"type": "array"
},
"email": {
"format": "email",
"type": "string"
},
"key_path": {
"type": "string"
},
"provider": {
"const": "local",
"type": "string"
}
},
"required": [
"domains",
"email",
"provider"
],
"type": "object"
},
"MiddlewareComposeMap": {
"anyOf": [
{
"additionalProperties": false,
"properties": {
"use": {
"enum": [
"CustomErrorPage",
"ErrorPage",
"customErrorPage",
"custom_error_page",
"errorPage",
"error_page"
],
"type": "string"
}
},
"required": [
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"use": {
"enum": [
"RedirectHTTP",
"redirectHTTP",
"redirect_http"
],
"type": "string"
}
},
"required": [
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"use": {
"enum": [
"SetXForwarded",
"setXForwarded",
"set_x_forwarded"
],
"type": "string"
}
},
"required": [
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"use": {
"enum": [
"HideXForwarded",
"hideXForwarded",
"hide_x_forwarded"
],
"type": "string"
}
},
"required": [
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"allow": {
"items": {
"$ref": "#/definitions/CIDR"
},
"type": "array"
},
"message": {
"default": "IP not allowed",
"description": "Error message when blocked",
"type": "string"
},
"status": {
"$ref": "#/definitions/StatusCode",
"default": 403,
"description": "HTTP status code when blocked (alias of status_code)"
},
"status_code": {
"$ref": "#/definitions/StatusCode",
"default": 403,
"description": "HTTP status code when blocked"
},
"use": {
"enum": [
"CIDRWhitelist",
"cidrWhitelist",
"cidr_whitelist"
],
"type": "string"
}
},
"required": [
"allow",
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"recursive": {
"default": false,
"description": "Recursively resolve the IP",
"type": "boolean"
},
"use": {
"enum": [
"cloudflareRealIp",
"cloudflare_real_ip"
],
"type": "string"
}
},
"required": [
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"add_headers": {
"additionalProperties": {
"type": "string"
},
"description": "Add HTTP headers",
"type": "object"
},
"hide_headers": {
"description": "Hide HTTP headers",
"items": {
"type": "string"
},
"type": "array"
},
"set_headers": {
"additionalProperties": {
"type": "string"
},
"description": "Set HTTP headers",
"type": "object"
},
"use": {
"enum": [
"ModifyRequest",
"Request",
"modifyRequest",
"modify_request",
"request"
],
"type": "string"
}
},
"required": [
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"add_headers": {
"additionalProperties": {
"type": "string"
},
"description": "Add HTTP headers",
"type": "object"
},
"hide_headers": {
"description": "Hide HTTP headers",
"items": {
"type": "string"
},
"type": "array"
},
"set_headers": {
"additionalProperties": {
"type": "string"
},
"description": "Set HTTP headers",
"type": "object"
},
"use": {
"enum": [
"ModifyResponse",
"Response",
"modifyResponse",
"modify_response",
"response"
],
"type": "string"
}
},
"required": [
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"allowed_groups": {
"description": "Allowed groups",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
},
"allowed_users": {
"description": "Allowed users",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
},
"use": {
"enum": [
"OIDC",
"oidc"
],
"type": "string"
}
},
"required": [
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"average": {
"description": "Average number of requests allowed in a period",
"type": "number"
},
"burst": {
"description": "Maximum number of requests allowed in a period",
"type": "number"
},
"period": {
"default": "1s",
"description": "Duration of the rate limit",
"pattern": "^([0-9]+(ms|s|m|h))+$",
"type": "string"
},
"use": {
"enum": [
"RateLimit",
"rateLimit",
"rate_limit"
],
"type": "string"
}
},
"required": [
"average",
"burst",
"use"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"from": {
"items": {
"$ref": "#/definitions/CIDR"
},
"type": "array"
},
"header": {
"default": "X-Real-IP",
"description": "Header to get the client IP from",
"pattern": "^[a-zA-Z0-9\\-]+$",
"type": "string"
},
"recursive": {
"default": false,
"description": "Recursive resolve the IP",
"type": "boolean"
},
"use": {
"enum": [
"RealIP",
"realIP",
"real_ip"
],
"type": "string"
}
},
"required": [
"from",
"use"
],
"type": "object"
}
]
},
"OVHEndpoint": {
"enum": [
"kimsufi-ca",
"kimsufi-eu",
"ovh-ca",
"ovh-eu",
"ovh-us",
"soyoustart-ca",
"soyoustart-eu"
],
"type": "string"
},
"OVHOptionsWithAppKey": {
"additionalProperties": false,
"properties": {
"cert_path": {
"type": "string"
},
"domains": {
"items": {
"pattern": "^(\\*\\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$"
},
"type": "array"
},
"email": {
"format": "email",
"type": "string"
},
"key_path": {
"type": "string"
},
"options": {
"additionalProperties": false,
"properties": {
"api_endpoint": {
"$ref": "#/definitions/OVHEndpoint"
},
"application_key": {
"type": "string"
},
"application_secret": {
"type": "string"
},
"consumer_key": {
"type": "string"
}
},
"required": [
"application_key",
"application_secret",
"consumer_key"
],
"type": "object"
},
"provider": {
"const": "ovh",
"type": "string"
}
},
"required": [
"domains",
"email",
"options",
"provider"
],
"type": "object"
},
"OVHOptionsWithOAuth2Config": {
"additionalProperties": false,
"properties": {
"cert_path": {
"type": "string"
},
"domains": {
"items": {
"pattern": "^(\\*\\.)?(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$"
},
"type": "array"
},
"email": {
"format": "email",
"type": "string"
},
"key_path": {
"type": "string"
},
"options": {
"additionalProperties": false,
"properties": {
"api_endpoint": {
"$ref": "#/definitions/OVHEndpoint"
},
"application_secret": {
"type": "string"
},
"consumer_key": {
"type": "string"
},
"oauth2_config": {
"additionalProperties": false,
"properties": {
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
}
},
"required": [
"client_id",
"client_secret"
],
"type": "object"
}
},
"required": [
"application_secret",
"consumer_key",
"oauth2_config"
],
"type": "object"
},
"provider": {
"const": "ovh",
"type": "string"
}
},
"required": [
"domains",
"email",
"options",
"provider"
],
"type": "object"
},
"StatusCode": {
"anyOf": [
{
"pattern": "^[0-9]*$",
"type": "string"
},
{
"type": "number"
}
]
},
"StatusCodeRange": {
"anyOf": [
{
"pattern": "^[0-9]*$",
"type": "string"
},
{
"pattern": "^[0-9]*-[0-9]*$",
"type": "string"
},
{
"type": "number"
}
]
},
"WebhookColorMode": {
"enum": [
"dec",
"hex"
],
"type": "string"
},
"WebhookConfig": {
"additionalProperties": false,
"properties": {
"color_mode": {
"$ref": "#/definitions/WebhookColorMode",
"default": "hex",
"description": "Webhook color mode"
},
"method": {
"$ref": "#/definitions/WebhookMethod",
"default": "POST",
"description": "Webhook method"
},
"mime_type": {
"$ref": "#/definitions/WebhookMimeType",
"default": "application/json",
"description": "Webhook mime type"
},
"name": {
"type": "string"
},
"payload": {
"description": "Webhook message (usally JSON),\nrequired when template is not defined",
"type": "string"
},
"provider": {
"const": "webhook",
"type": "string"
},
"template": {
"const": "discord",
"default": "discord",
"description": "Webhook template",
"type": "string"
},
"token": {
"type": "string"
},
"url": {
"format": "uri",
"type": "string"
}
},
"required": [
"name",
"provider",
"url"
],
"type": "object"
},
"WebhookMethod": {
"enum": [
"GET",
"POST",
"PUT"
],
"type": "string"
},
"WebhookMimeType": {
"enum": [
"application/json",
"application/x-www-form-urlencoded",
"text/plain"
],
"type": "string"
}
},
"properties": {
"autocert": {
"$ref": "#/definitions/AutocertConfig",
"description": "Optional autocert configuration",
"examples": [
{
"provider": "local"
},
{
"domains": [
"example.com"
],
"email": "abc@gmail",
"options": {
"auth_token": "c1234565789-abcdefghijklmnopqrst"
},
"provider": "cloudflare"
},
{
"domains": [
"example.com"
],
"email": "abc@gmail",
"options": {
"client_id": "c1234565789",
"email": "abc@gmail",
"password": "password"
},
"provider": "clouddns"
}
]
},
"entrypoint": {
"additionalProperties": false,
"properties": {
"access_log": {
"additionalProperties": false,
"description": "Entrypoint access log configuration",
"examples": [
{
"fields": {
"headers": {
"config": {
"foo": "redact"
},
"default": "keep"
}
},
"filters": {
"status_codes": {
"values": [
"200-299"
]
}
},
"format": "combined",
"path": "/var/log/access.log"
}
],
"properties": {
"buffer_size": {
"default": 65536,
"description": "The size of the buffer.",
"minimum": 0,
"type": "integer"
},
"fields": {
"additionalProperties": false,
"properties": {
"cookie": {
"additionalProperties": false,
"properties": {
"config": {
"additionalProperties": {
"enum": [
"drop",
"keep",
"redact"
],
"type": "string"
},
"type": "object"
},
"default": {
"$ref": "#/definitions/AccessLogFieldMode"
}
},
"required": [
"config"
],
"type": "object"
},
"header": {
"additionalProperties": false,
"properties": {
"config": {
"additionalProperties": {
"enum": [
"drop",
"keep",
"redact"
],
"type": "string"
},
"type": "object"
},
"default": {
"$ref": "#/definitions/AccessLogFieldMode"
}
},
"required": [
"config"
],
"type": "object"
},
"query": {
"additionalProperties": false,
"properties": {
"config": {
"additionalProperties": {
"enum": [
"drop",
"keep",
"redact"
],
"type": "string"
},
"type": "object"
},
"default": {
"$ref": "#/definitions/AccessLogFieldMode"
}
},
"required": [
"config"
],
"type": "object"
}
},
"type": "object"
},
"filters": {
"additionalProperties": false,
"properties": {
"cidr": {
"additionalProperties": false,
"properties": {
"negative": {
"default": false,
"description": "Whether the filter is negative.",
"type": "boolean"
},
"values": {
"items": {
"$ref": "#/definitions/CIDR"
},
"type": "array"
}
},
"required": [
"values"
],
"type": "object"
},
"headers": {
"additionalProperties": false,
"properties": {
"negative": {
"default": false,
"description": "Whether the filter is negative.",
"type": "boolean"
},
"values": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"values"
],
"type": "object"
},
"host": {
"additionalProperties": false,
"properties": {
"negative": {
"default": false,
"description": "Whether the filter is negative.",
"type": "boolean"
},
"values": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"values"
],
"type": "object"
},
"method": {
"additionalProperties": false,
"properties": {
"negative": {
"default": false,
"description": "Whether the filter is negative.",
"type": "boolean"
},
"values": {
"items": {
"enum": [
"CONNECT",
"DELETE",
"GET",
"HEAD",
"OPTIONS",
"PATCH",
"POST",
"PUT",
"TRACE"
],
"type": "string"
},
"type": "array"
}
},
"required": [
"values"
],
"type": "object"
},
"status_code": {
"additionalProperties": false,
"properties": {
"negative": {
"default": false,
"description": "Whether the filter is negative.",
"type": "boolean"
},
"values": {
"items": {
"$ref": "#/definitions/StatusCodeRange"
},
"type": "array"
}
},
"required": [
"values"
],
"type": "object"
}
},
"type": "object"
},
"format": {
"$ref": "#/definitions/AccessLogFormat",
"default": "combined",
"description": "The format of the access log."
},
"path": {
"format": "uri-reference",
"type": "string"
}
},
"required": [
"path"
],
"type": "object"
},
"middlewares": {
"description": "Entrypoint middleware configuration",
"examples": [
{
"use": "RedirectHTTP"
},
{
"allow": [
"127.0.0.1",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
],
"message": "Forbidden",
"status": 403,
"use": "CIDRWhitelist"
}
],
"items": {
"$ref": "#/definitions/MiddlewareComposeMap"
},
"type": "array"
}
},
"required": [
"middlewares"
],
"type": "object"
},
"homepage": {
"additionalProperties": false,
"properties": {
"use_default_categories": {
"default": true,
"description": "Use default app categories (uses docker image name)",
"type": "boolean"
}
},
"required": [
"use_default_categories"
],
"type": "object"
},
"match_domains": {
"description": "Optional list of domains to match",
"examples": [
"example.com",
"*.example.com"
],
"items": {
"pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$"
},
"minItems": 1,
"type": "array"
},
"providers": {
"additionalProperties": false,
"properties": {
"docker": {
"additionalProperties": {
"type": "string"
},
"description": "Name-value mapping of docker hosts to retrieve routes from",
"examples": [
{
"local": "$DOCKER_HOST"
},
{
"remote": "tcp://10.0.2.1:2375"
},
{
"remote2": "ssh://root:1234@10.0.2.2"
}
],
"items": {
"pattern": "^((\\w+://)[^\\s]+)|\\$DOCKER_HOST$"
},
"minProperties": 1,
"type": "object"
},
"include": {
"description": "List of route definition files to include",
"examples": [
"file1.yml",
"file2.yml"
],
"items": {
"pattern": "^[\\w\\d\\-_]+\\.(yaml|yml)$"
},
"minItems": 1,
"type": "array"
},
"notification": {
"description": "List of notification providers",
"examples": [
{
"name": "gotify",
"provider": "gotify",
"token": "abcd",
"url": "https://gotify.domain.tld"
},
{
"name": "discord",
"provider": "webhook",
"template": "discord",
"url": "https://discord.com/api/webhooks/1234/abcd"
}
],
"items": {
"anyOf": [
{
"$ref": "#/definitions/GotifyConfig"
},
{
"$ref": "#/definitions/WebhookConfig"
}
]
},
"minItems": 1,
"type": "array"
}
},
"type": "object"
},
"timeout_shutdown": {
"default": 3,
"description": "Optional timeout before shutdown",
"minimum": 1,
"type": "number"
}
},
"required": [
"providers"
],
"type": "object"
}