Skip to content

Commit

Permalink
Add json schema
Browse files Browse the repository at this point in the history
Remove redundant CA cert check
  • Loading branch information
nickdnk committed Oct 24, 2024
1 parent 714e81a commit 614c8fb
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (c *Config) InitDefaults() error { //nolint:gocyclo,gocognit

func (c *Config) EnableTLS() bool {
if c.TLS != nil {
return (c.TLS.RootCA != "" && c.TLS.Key != "" && c.TLS.Cert != "") || (c.TLS.Key != "" && c.TLS.Cert != "")
return c.TLS.Key != "" && c.TLS.Cert != ""
}
return false
}
99 changes: 99 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{
"$id": "https://raw.githubusercontent.com/roadrunner-server/grpc/refs/heads/master/schema.json",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"description": "All the valid configuration parameters for the gRPC plugin for RoadRunner.",
"type": "object",
"title": "roadrunner-grpc",
"additionalProperties": false,
"required": [
"proto"
],
"properties": {
"listen": {
"description": "GRPC address to listen on.",
"$ref": "https://raw.githubusercontent.com/roadrunner-server/roadrunner/refs/heads/master/schemas/config/3.0.schema.json#/definitions/HostAndPortWithTCP"
},
"proto": {
"type": "array",
"minItems": 1,
"description": "Proto file to use. Multiple files are supported. Wildcards are allowed in the proto field.",
"items": {
"type": "string",
"minLength": 1,
"examples": [
"*.proto",
"first.proto",
"second.proto"
]
}
},
"tls": {
"description": "GRPC TLS configuration",
"type": "object",
"additionalProperties": false,
"properties": {
"key": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/http/refs/heads/master/schema.json#/$defs/SSL/properties/key"
},
"cert": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/http/refs/heads/master/schema.json#/$defs/SSL/properties/cert"
},
"root_ca": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/http/refs/heads/master/schema.json#/$defs/SSL/properties/root_ca"
},
"client_auth_type": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/http/refs/heads/master/schema.json#/$defs/ClientAuthType"
}
},
"required": [
"key",
"cert"
]
},
"max_send_msg_size": {
"type": "integer",
"description": "Maximum send message size in MB.",
"default": 50
},
"max_recv_msg_size": {
"type": "integer",
"description": "Maximum receive message size in MB.",
"default": 50
},
"max_connection_idle": {
"description": " MaxConnectionIdle is a duration for the amount of time after which an idle connection would be closed by sending a GoAway. Idle duration is defined by the most recent time the number of outstanding RPCs became zero or since the connection was established. Defaults to infinite.",
"$ref": "#/$defs/duration"
},
"max_connection_age": {
"description": "The maximum duration a connection may exist before it will be closed by sending a GoAway. A random jitter of +/-10% will be added to MaxConnectionAge to spread out connection storms. Defaults to infinite.",
"$ref": "#/$defs/duration"
},
"max_connection_age_grace": {
"description": "The duration after MaxConnectionAge after which the connection will be forcibly closed. Defaults to infinite.",
"$ref": "#/$defs/duration"
},
"max_concurrent_streams": {
"description": "The maximum number of concurrent streams. Empty or 0 means 10.",
"type": "integer",
"default": 10
},
"ping_time": {
"description": "Duration of no activity after which the server pings the client to see if the transport is still alive. If set below 1s, a minimum value of 1s will be used instead.",
"$ref": "#/$defs/duration",
"default": "2h"
},
"timeout": {
"description": "The duration to wait for a response to a keepalive check, after which the connection is closed.",
"$ref": "#/$defs/duration",
"default": "20s"
},
"pool": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/pool/refs/heads/master/schema.json"
}
},
"$defs": {
"duration": {
"$ref": "https://raw.githubusercontent.com/roadrunner-server/roadrunner/refs/heads/master/schemas/config/3.0.schema.json#/$defs/duration"
}
}
}

0 comments on commit 614c8fb

Please sign in to comment.