From 969b8858dc481220e67d0a8de4822adbee566da9 Mon Sep 17 00:00:00 2001 From: Nicolai Cornelis Date: Thu, 24 Oct 2024 20:55:48 +0200 Subject: [PATCH 1/2] Add JSON schema fix missing pool default init --- config.go | 2 +- schema.json | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 schema.json diff --git a/config.go b/config.go index 80a70cf..ba65fa4 100644 --- a/config.go +++ b/config.go @@ -50,8 +50,8 @@ func (c *Config) InitDefaults() error { if c.Pool == nil { c.Pool = &pool.Config{} - c.Pool.InitDefaults() } + c.Pool.InitDefaults() if c.TLS != nil { //nolint:nestif if _, err := os.Stat(c.TLS.Key); err != nil { diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..6d9738f --- /dev/null +++ b/schema.json @@ -0,0 +1,56 @@ +{ + "$id": "https://raw.githubusercontent.com/roadrunner-server/centrifuge/refs/heads/master/schema.json", + "$schema": "https://json-schema.org/draft/2019-09/schema", + "description": "All the valid configuration parameters for the Centrifugo plugin for RoadRunner.", + "type": "object", + "title": "roadrunner-centrifuge", + "additionalProperties": false, + "properties": { + "proxy_address": { + "description": "The address of the Centrifugo proxy server.", + "type": "string", + "default": "tcp://127.0.0.1:30000" + }, + "grpc_api_address": { + "description": "The address/port of the gRPC server API.", + "type": "string", + "default": "tcp://127.0.0.1:10000" + }, + "use_compressor": { + "description": "Whether to use gRPC gzip compressor.", + "type": "boolean", + "default": false + }, + "version": { + "description": "Your application version.", + "type": "string", + "default": "v1.0.0" + }, + "name": { + "description": "Your application name.", + "type": "string", + "default": "roadrunner", + "minLength": 1 + }, + "pool": { + "$ref": "https://raw.githubusercontent.com/roadrunner-server/pool/refs/heads/master/schema.json" + }, + "tls": { + "description": "TLS settings", + "type": "object", + "additionalProperties": false, + "properties": { + "cert": { + "$ref": "https://raw.githubusercontent.com/roadrunner-server/http/refs/heads/master/schema.json#/$defs/SSL/properties/cert" + }, + "key": { + "$ref": "https://raw.githubusercontent.com/roadrunner-server/http/refs/heads/master/schema.json#/$defs/SSL/properties/key" + } + }, + "required": [ + "cert", + "key" + ] + } + } +} From bcb87d0c45a48265004803e728bfc0858b4bcea9 Mon Sep 17 00:00:00 2001 From: Nicolai Cornelis Date: Fri, 25 Oct 2024 04:53:13 +0200 Subject: [PATCH 2/2] Add min length --- schema.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/schema.json b/schema.json index 6d9738f..d7c3255 100644 --- a/schema.json +++ b/schema.json @@ -9,12 +9,14 @@ "proxy_address": { "description": "The address of the Centrifugo proxy server.", "type": "string", - "default": "tcp://127.0.0.1:30000" + "default": "tcp://127.0.0.1:30000", + "minLength": 1 }, "grpc_api_address": { "description": "The address/port of the gRPC server API.", "type": "string", - "default": "tcp://127.0.0.1:10000" + "default": "tcp://127.0.0.1:10000", + "minLength": 1 }, "use_compressor": { "description": "Whether to use gRPC gzip compressor.", @@ -24,7 +26,8 @@ "version": { "description": "Your application version.", "type": "string", - "default": "v1.0.0" + "default": "v1.0.0", + "minLength": 1 }, "name": { "description": "Your application name.",