ergo: reload, accounts, channels, doc

This commit is contained in:
lassulus 2021-12-29 15:52:29 +01:00
parent 42bb86b812
commit 8a24a9f395

View File

@ -6,6 +6,7 @@
type = (pkgs.formats.json {}).type; type = (pkgs.formats.json {}).type;
description = '' description = ''
Ergo IRC daemon configuration file. Ergo IRC daemon configuration file.
https://raw.githubusercontent.com/ergochat/ergo/master/default.yaml
''; '';
default = { default = {
network = { network = {
@ -34,19 +35,34 @@
}; };
}; };
datastore = { datastore = {
autoupgrade = true;
path = "/var/lib/ergo/ircd.db"; path = "/var/lib/ergo/ircd.db";
}; };
accounts = { accounts = {
authentication-enabled = true; authentication-enabled = true;
registration = { registration = {
enabled = true; enabled = true;
email-verification = { allow-before-connect = true;
enabled = false; throttling = {
enabled = true;
duration = "10m";
max-attempts = 30;
};
bcrypt-cost = 4;
email-verification.enabled = false;
multiclient = {
enabled = true;
allowed-by-default = true;
always-on = "opt-in";
auto-away = "opt-in";
}; };
}; };
}; };
channels = { channels = {
default-modes = "+nt"; default-modes = "+ntC";
registration = {
enabled = true;
};
}; };
limits = { limits = {
nicklen = 32; nicklen = 32;
@ -56,6 +72,31 @@
kicklen = 390; kicklen = 390;
topiclen = 390; topiclen = 390;
}; };
history = {
enabled = true;
channel-length = 2048;
client-length = 256;
autoresize-window = "3d";
autoreplay-on-join = 0;
chathistory-maxmessages = 100;
znc-maxmessages = 2048;
restrictions = {
expire-time = "1w";
query-cutoff = "none";
grace-period = "1h";
};
retention = {
allow-individual-delete = false;
enable-account-indexing = false;
};
tagmsg-storage = {
default = false;
whitelist = [
"+draft/react"
"+react"
];
};
};
}; };
}; };
}; };
@ -64,13 +105,17 @@
cfg = config.krebs.ergo; cfg = config.krebs.ergo;
configFile = pkgs.writeJSON "ergo.conf" cfg.config; configFile = pkgs.writeJSON "ergo.conf" cfg.config;
in lib.mkIf cfg.enable ({ in lib.mkIf cfg.enable ({
environment.etc."ergo.yaml".source = configFile;
krebs.ergo.config = krebs.ergo.config =
lib.mapAttrsRecursive (_: lib.mkDefault) options.krebs.ergo.config.default; lib.mapAttrsRecursive (_: lib.mkDefault) options.krebs.ergo.config.default;
systemd.services.ergo = { systemd.services.ergo = {
description = "Ergo IRC daemon"; description = "Ergo IRC daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
reloadIfChanged = true;
restartTriggers = [ configFile ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.ergo}/bin/ergo run --conf ${configFile}"; ExecStart = "${pkgs.ergo}/bin/ergo run --conf /etc/ergo.yaml";
ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID";
DynamicUser = true; DynamicUser = true;
StateDirectory = "ergo"; StateDirectory = "ergo";
}; };