diff --git a/cmd/soju/main.go b/cmd/soju/main.go index 1293cb5..e8b64ae 100644 --- a/cmd/soju/main.go +++ b/cmd/soju/main.go @@ -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, diff --git a/config/config.go b/config/config.go index 2705942..27260e7 100644 --- a/config/config.go +++ b/config/config.go @@ -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 diff --git a/doc/soju.1.scd b/doc/soju.1.scd index 1f3c527..0c09255 100644 --- a/doc/soju.1.scd +++ b/doc/soju.1.scd @@ -133,9 +133,15 @@ The following directives are supported: strings, see: . -*message-store* fs - Path to the bouncer logs root directory, or empty to disable logging. By - default, logging is disabled. +*message-store* [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.)