- 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).
37 lines
951 B
Go
37 lines
951 B
Go
package config
|
|
|
|
import "reflect"
|
|
|
|
// JSCKDatabase is the database section's configuration key.
|
|
const JSCKDatabase string = "database"
|
|
|
|
// JSCDatabase configures the SQLite database. File is the path to
|
|
// the database file; empty means none, and commands that need the database
|
|
// fail with a message saying so.
|
|
type JSCDatabase struct {
|
|
File string `cfg:"file"`
|
|
}
|
|
|
|
// ---------- Section methods (see Section) ----------
|
|
|
|
// Keys returns the keys directly in the section.
|
|
func (c *JSCDatabase) Keys() []string { return keysOf(c) }
|
|
|
|
func (c JSCDatabase) Map() map[string]any { return mapOf(c) }
|
|
|
|
func (c JSCDatabase) Flatten() map[string]any {
|
|
return flattenOf(JSCKDatabase, c)
|
|
}
|
|
|
|
func (c JSCDatabase) TypeOf(key string) (reflect.Kind, error) {
|
|
return typeOf(c, key)
|
|
}
|
|
|
|
func (c JSCDatabase) ValueOf(key string) (any, error) {
|
|
return valueOf(c, key)
|
|
}
|
|
|
|
func (c *JSCDatabase) SetValue(key string, value any) error {
|
|
return setValue(c, key, value)
|
|
}
|