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