- a source's interval must be greater than 0: a source is turned off with enabled, not with a zero interval, so JSCSourcesSource rejects an interval of 0 or less (its validate is promoted to each source's section); - max_message_size rejects -1: JSCServerWebSocket rejects a max_message_size of -1 (util.ByteSizeNoLimit), as a client could then exhaust the server's memory; - every setting documents what 0 or empty means (zero/none, no limit or a default).
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package config
|
|
|
|
import (
|
|
"reflect"
|
|
)
|
|
|
|
// JSCKServer is the server section's configuration key.
|
|
const JSCKServer string = "server"
|
|
|
|
// JSCServer configures the outward server. Host is the address to listen
|
|
// on (empty means every interface) and Port the port (0 means any free
|
|
// port).
|
|
type JSCServer struct {
|
|
Host string `cfg:"host" default:"127.0.0.1"`
|
|
Port int `cfg:"port" default:"9393"`
|
|
Timeouts JSCServerTimeouts `cfg:"timeouts"`
|
|
RateLimits JSCServerRateLimits `cfg:"rate_limits"`
|
|
WebSocket JSCServerWebSocket `cfg:"websocket"`
|
|
}
|
|
|
|
// ---------- Section methods (see Section) ----------
|
|
|
|
func (c JSCServer) Map() map[string]any { return mapOf(c) }
|
|
|
|
func (c JSCServer) Flatten() map[string]any {
|
|
return flattenOf(JSCKServer, c)
|
|
}
|
|
|
|
func (c JSCServer) TypeOf(key string) (reflect.Kind, error) {
|
|
return typeOf(c, key)
|
|
}
|
|
|
|
func (c JSCServer) ValueOf(key string) (any, error) {
|
|
return valueOf(c, key)
|
|
}
|
|
|
|
func (c *JSCServer) SetValue(key string, value any) error {
|
|
return setValue(c, key, value)
|
|
}
|