~emersion/soju

706b6e33fb41cca92af664f2e4cc09d84d31a624 — Simon Ser 19 days ago fd365f9 v0.1.0
Make db and log config options more future-proof

Rename the "sql" directive to "db". Rename the "log" directive to
"log fs".

In the future, we'll maybe support more databases and more message
stores. Make it so it's easy to integrate these new festures to the
config file format.
3 files changed, 11 insertions(+), 9 deletions(-)

M config.in
M config/config.go
M doc/soju.1.scd
M config.in => config.in +2 -2
@@ 1,2 1,2 @@
sql sqlite3 /var/lib/soju/main.db
log /var/lib/soju/logs/
db sqlite3 /var/lib/soju/main.db
log fs /var/lib/soju/logs/

M config/config.go => config/config.go +6 -2
@@ 86,14 86,18 @@ func parse(cfg scfg.Block) (*Server, error) {
				return nil, err
			}
			srv.TLS = tls
		case "sql":
		case "db":
			if err := d.ParseParams(&srv.SQLDriver, &srv.SQLSource); err != nil {
				return nil, err
			}
		case "log":
			if err := d.ParseParams(&srv.LogPath); err != nil {
			var driver string
			if err := d.ParseParams(&driver, &srv.LogPath); err != nil {
				return nil, err
			}
			if driver != "fs" {
				return nil, fmt.Errorf("directive %q: unknown driver %q", d.Name, driver)
			}
		case "http-origin":
			srv.HTTPOrigins = d.Params
		case "accept-proxy-ip":

M doc/soju.1.scd => doc/soju.1.scd +3 -5
@@ 101,12 101,10 @@ The following directives are supported:
*tls* <cert> <key>
	Enable TLS support. The certificate and the key files must be PEM-encoded.

*sql* <driver> <source>
	Set the SQL driver settings. The only supported driver is "sqlite3". The
	source is the path to the SQLite database file. By default, the path to the
	database file is "soju.db".
*db* sqlite3 <path>
	Set the SQLite database path (default: "soju.db" in the current directory).

*log* <path>
*log* fs <path>
	Path to the bouncer logs root directory, or empty to disable logging. By
	default, logging is disabled.