config: add message-store memory
The old way to do this was `message-store fs ""`, which is misleading.
This commit is contained in:
parent
80ed0d2a6c
commit
e2e232fa9c
@ -86,7 +86,7 @@ func loadConfig() (*config.Server, *soju.Config, error) {
|
||||
cfg := &soju.Config{
|
||||
Hostname: raw.Hostname,
|
||||
Title: raw.Title,
|
||||
LogPath: raw.LogPath,
|
||||
LogPath: raw.MsgStoreSource,
|
||||
HTTPOrigins: raw.HTTPOrigins,
|
||||
AcceptProxyIPs: raw.AcceptProxyIPs,
|
||||
MaxUserNetworks: raw.MaxUserNetworks,
|
||||
|
@ -45,7 +45,9 @@ type Server struct {
|
||||
|
||||
SQLDriver string
|
||||
SQLSource string
|
||||
LogPath string
|
||||
|
||||
MsgStoreDriver string
|
||||
MsgStoreSource string
|
||||
|
||||
HTTPOrigins []string
|
||||
AcceptProxyIPs IPSet
|
||||
@ -64,6 +66,7 @@ func Defaults() *Server {
|
||||
Hostname: hostname,
|
||||
SQLDriver: "sqlite3",
|
||||
SQLSource: "soju.db",
|
||||
MsgStoreDriver: "memory",
|
||||
MaxUserNetworks: -1,
|
||||
MultiUpstream: true,
|
||||
}
|
||||
@ -110,12 +113,18 @@ func parse(cfg scfg.Block) (*Server, error) {
|
||||
return nil, err
|
||||
}
|
||||
case "message-store", "log":
|
||||
var driver string
|
||||
if err := d.ParseParams(&driver, &srv.LogPath); err != nil {
|
||||
if err := d.ParseParams(&srv.MsgStoreDriver); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if driver != "fs" {
|
||||
return nil, fmt.Errorf("directive %q: unknown driver %q", d.Name, driver)
|
||||
switch srv.MsgStoreDriver {
|
||||
case "memory":
|
||||
srv.MsgStoreSource = ""
|
||||
case "fs":
|
||||
if err := d.ParseParams(nil, &srv.MsgStoreSource); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("directive %q: unknown driver %q", d.Name, srv.MsgStoreDriver)
|
||||
}
|
||||
case "http-origin":
|
||||
srv.HTTPOrigins = d.Params
|
||||
|
@ -133,9 +133,15 @@ The following directives are supported:
|
||||
strings, see:
|
||||
<https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters>.
|
||||
|
||||
*message-store* fs <path>
|
||||
Path to the bouncer logs root directory, or empty to disable logging. By
|
||||
default, logging is disabled.
|
||||
*message-store* <driver> [source]
|
||||
Set the database location for IRC messages. By default, an in-memory message
|
||||
database is used.
|
||||
|
||||
Supported drivers:
|
||||
|
||||
- _memory_ stores messages in memory.
|
||||
- _fs_ stores messages on disk, in the same format as ZNC. _source_ is
|
||||
required and is the root directory path for the database.
|
||||
|
||||
(_log_ is a deprecated alias for this directive.)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user