@@ -18,31 +18,12 @@ import (
18
18
)
19
19
20
20
type Config struct {
21
- // Address to bind HTTP server to.
22
- Address string `mapstructure:"address" json:"address" envconfig:"address" toml:"address" yaml:"address"`
23
- // Port to bind HTTP server to.
24
- Port int `mapstructure:"port" json:"port" envconfig:"port" default:"8000" toml:"port" yaml:"port"`
25
- // InternalAddress to bind internal HTTP server to. Internal server is used to serve endpoints
26
- // which are normally should not be exposed to the outside world.
27
- InternalAddress string `mapstructure:"internal_address" json:"internal_address" envconfig:"internal_address" toml:"internal_address" yaml:"internal_address"`
28
- // InternalPort to bind internal HTTP server to.
29
- InternalPort string `mapstructure:"internal_port" json:"internal_port" envconfig:"internal_port" toml:"internal_port" yaml:"internal_port"`
30
- // PidFile is a path to write PID file with server's PID.
21
+ // PidFile is a path to write a file with Centrifugo process PID.
31
22
PidFile string `mapstructure:"pid_file" json:"pid_file" envconfig:"pid_file" toml:"pid_file" yaml:"pid_file"`
32
- // LogLevel is a log level for Centrifugo logger. Supported values: none, trace, debug, info, warn, error.
33
- LogLevel string `mapstructure:"log_level" json:"log_level" envconfig:"log_level" default:"info" toml:"log_level" yaml:"log_level"`
34
- // LogFile is a path to log file. If not set logs go to stdout.
35
- LogFile string `mapstructure:"log_file" json:"log_file" envconfig:"log_file" toml:"log_file" yaml:"log_file"`
36
-
37
- // TLS configuration for HTTP server.
38
- TLS configtypes.TLSConfig `mapstructure:"tls" json:"tls" envconfig:"tls" toml:"tls" yaml:"tls"`
39
- // TLSAutocert for automatic TLS certificates from ACME provider (ex. Let's Encrypt).
40
- TLSAutocert configtypes.TLSAutocert `mapstructure:"tls_autocert" json:"tls_autocert" envconfig:"tls_autocert" toml:"tls_autocert" yaml:"tls_autocert"`
41
- // TLSExternal enables TLS only for external HTTP endpoints.
42
- TLSExternal bool `mapstructure:"tls_external" json:"tls_external" envconfig:"tls_external" toml:"tls_external" yaml:"tls_external"`
43
- // InternalTLS is a custom configuration for internal HTTP endpoints. If not set InternalTLS will be the same as TLS.
44
- InternalTLS configtypes.TLSConfig `mapstructure:"internal_tls" json:"internal_tls" envconfig:"internal_tls" toml:"internal_tls" yaml:"internal_tls"`
45
-
23
+ // HTTP is a configuration for Centrifugo HTTP server.
24
+ HTTP configtypes.HTTPServer `mapstructure:"http_server" json:"http_server" envconfig:"http_server" toml:"http_server" yaml:"http_server"`
25
+ // Log is a configuration for logging.
26
+ Log configtypes.Log `mapstructure:"log" json:"log" envconfig:"log" toml:"log" yaml:"log"`
46
27
// Engine is a configuration for Centrifugo engine. It's a handy combination of Broker and PresenceManager.
47
28
// Currently only memory and redis engines are supported – both implement all the features. For more granular
48
29
// control use Broker and PresenceManager options.
@@ -109,9 +90,6 @@ type Config struct {
109
90
// Debug helps to enable Go profiling endpoints.
110
91
Debug configtypes.Debug `mapstructure:"debug" json:"debug" envconfig:"debug" toml:"debug" yaml:"debug"`
111
92
112
- // HTTP3 enables HTTP/3 support. EXPERIMENTAL.
113
- HTTP3 configtypes.HTTP3 `mapstructure:"http3" json:"http3" envconfig:"http3" toml:"http3" yaml:"http3"`
114
-
115
93
// OpenTelemetry is a configuration for OpenTelemetry tracing.
116
94
OpenTelemetry configtypes.OpenTelemetry `mapstructure:"opentelemetry" json:"opentelemetry" envconfig:"opentelemetry" toml:"opentelemetry" yaml:"opentelemetry"`
117
95
// Graphite is a configuration for export metrics to Graphite.
@@ -136,18 +114,18 @@ type Meta struct {
136
114
}
137
115
138
116
func DefineFlags (rootCmd * cobra.Command ) {
139
- rootCmd .Flags ().StringP ("address" , "a" , "" , "interface address to listen on" )
140
- rootCmd .Flags ().StringP ("port" , "p" , "8000" , "port to bind HTTP server to" )
141
- rootCmd .Flags ().StringP ("internal_address" , "" , "" , "custom interface address to listen on for internal endpoints" )
142
- rootCmd .Flags ().StringP ("internal_port" , "" , "" , "custom port for internal endpoints" )
117
+ rootCmd .Flags ().StringP ("pid_file" , "" , "" , "optional path to create PID file" )
118
+ rootCmd .Flags ().StringP ("http_server.address" , "a" , "" , "interface address to listen on" )
119
+ rootCmd .Flags ().StringP ("http_server.port" , "p" , "8000" , "port to bind HTTP server to" )
120
+ rootCmd .Flags ().StringP ("http_server.internal_address" , "" , "" , "custom interface address to listen on for internal endpoints" )
121
+ rootCmd .Flags ().StringP ("http_server.internal_port" , "" , "" , "custom port for internal endpoints" )
143
122
rootCmd .Flags ().StringP ("engine.type" , "" , "memory" , "broker to use: ex. redis" )
144
123
rootCmd .Flags ().BoolP ("broker.enabled" , "" , false , "enable broker" )
145
124
rootCmd .Flags ().StringP ("broker.type" , "" , "memory" , "broker to use: ex. redis" )
146
125
rootCmd .Flags ().BoolP ("presence_manager.enabled" , "" , false , "enable presence manager" )
147
126
rootCmd .Flags ().StringP ("presence_manager.type" , "" , "memory" , "presence manager to use: ex. redis" )
148
- rootCmd .Flags ().StringP ("log_level" , "" , "info" , "set the log level: trace, debug, info, error, fatal or none" )
149
- rootCmd .Flags ().StringP ("log_file" , "" , "" , "optional log file - if not specified logs go to STDOUT" )
150
- rootCmd .Flags ().StringP ("pid_file" , "" , "" , "optional path to create PID file" )
127
+ rootCmd .Flags ().StringP ("log.level" , "" , "info" , "set the log level: trace, debug, info, error, fatal or none" )
128
+ rootCmd .Flags ().StringP ("log.file" , "" , "" , "optional log file - if not specified logs go to STDOUT" )
151
129
rootCmd .Flags ().BoolP ("debug.enabled" , "" , false , "enable debug endpoints" )
152
130
rootCmd .Flags ().BoolP ("admin.enabled" , "" , false , "enable admin web interface" )
153
131
rootCmd .Flags ().BoolP ("admin.external" , "" , false , "expose admin web interface on external port" )
0 commit comments