code.vegaprotocol.io/vega@v0.79.0/core/broker/config.go (about) 1 // Copyright (C) 2023 Gobalsky Labs Limited 2 // 3 // This program is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Affero General Public License as 5 // published by the Free Software Foundation, either version 3 of the 6 // License, or (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Affero General Public License for more details. 12 // 13 // You should have received a copy of the GNU Affero General Public License 14 // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 package broker 17 18 import ( 19 "time" 20 21 "code.vegaprotocol.io/vega/libs/config/encoding" 22 "code.vegaprotocol.io/vega/logging" 23 ) 24 25 const namedLogger = "broker" 26 27 // Config represents the configuration of the broker. 28 type Config struct { 29 Level encoding.LogLevel `long:"log-level"` 30 Socket SocketConfig `group:"Socket" namespace:"socket"` 31 File FileConfig `group:"File" namespace:"file"` 32 EventBusClientBufferSize int `long:"event-bus-client-buffer-size"` 33 } 34 35 // NewDefaultConfig creates an instance of config with default values. 36 func NewDefaultConfig() Config { 37 return Config{ 38 Level: encoding.LogLevel{Level: logging.InfoLevel}, 39 Socket: SocketConfig{ 40 DialTimeout: encoding.Duration{Duration: 96 * time.Hour}, 41 DialRetryInterval: encoding.Duration{Duration: 5 * time.Second}, 42 SocketQueueTimeout: encoding.Duration{Duration: 3 * time.Second}, 43 MaxSendTimeouts: 10, 44 EventChannelBufferSize: 10000000, 45 SocketChannelBufferSize: 1000000, 46 Address: "127.0.0.1", 47 Port: 3005, 48 Transport: "tcp", 49 Enabled: false, 50 }, 51 File: FileConfig{ 52 Enabled: false, 53 }, 54 EventBusClientBufferSize: 100000, 55 } 56 } 57 58 type SocketConfig struct { 59 DialTimeout encoding.Duration `description:" " long:"dial-timeout"` 60 DialRetryInterval encoding.Duration `description:" " long:"dial-retry-interval"` 61 62 SocketQueueTimeout encoding.Duration `description:" " long:"socket-queue-timeout"` 63 64 EventChannelBufferSize int `description:" " long:"event-channel-buffer-size"` 65 SocketChannelBufferSize int `description:" " long:"socket-channel-buffer-size"` 66 67 MaxSendTimeouts int `description:" " long:"max-send-timeouts"` 68 69 Address string `description:"Data node's address" long:"address"` 70 Port int `description:"Data node port" long:"port"` 71 Enabled encoding.Bool `description:"Enable streaming of bus events over socket" long:"enabled"` 72 Transport string `description:"Transport of socket. tcp/inproc are allowed. Default is TCP" long:"transport"` 73 } 74 75 type FileConfig struct { 76 Enabled encoding.Bool `description:"Enable streaming of bus events to a file" long:"enabled"` 77 File string `description:"Path of a file to write event log to" long:"file"` 78 }