obfuscate ids

This commit is contained in:
catvayor 2024-09-08 22:04:05 +02:00
parent b132d93b2f
commit 9aa2e5ccc8
Signed by: lbailly
GPG key ID: CE3E645251AC63F3

View file

@ -150,26 +150,43 @@ in
}; };
systemd.services = { systemd.services = {
traque = { traque = {
preStart = '' path = [ pkgs.outils ];
cat <<EOF > /var/lib/traque/Rocket.toml preStart =
[release] let
port = 8080 token-file = "/var/lib/traque/token";
ident = "Traque backend" NPCs = [
template_dir = "${traque-pkg}/share/traque-templates" "PNJ 0"
"PNJ 1"
];
Players = [
"Équipe 00"
"Équipe 01"
];
id-gen = name: ''sha1 <<< "$(cat ${token-file})${name}" | cut -c 1-10'';
in
''
cat <<EOF > /var/lib/traque/Rocket.toml
[release]
port = 8080
ident = "Traque backend"
template_dir = "${traque-pkg}/share/traque-templates"
blurred_move = [0.0005, 0.0005] blurred_move = [0.0005, 0.0005]
bonus_timeout = 5000 bonus_timeout = 120000
event_timeout = 100 event_timeout = 100
admin_token = "root" fairness_timeout = 30000
serve_static = false admin_token = "$(cat ${token-file})"
teams = [ serve_static = false
{ id = "team00", name = "Équipe 00", vieux = false}, teams = [
{ id = "team01", name = "Équipe 01", vieux = false}, ${
{ id = "npc0", name = "PNJ 0", vieux = true}, lib.concatStringsSep ",\n " (
{ id = "npc1", name = "PNJ 1", vieux = true}, map (npc: ''{ id = "$(${id-gen npc})", name = "${npc}", vieux = true }'') NPCs
] ++ map (player: ''{ id = "$(${id-gen player})", name = "${player}", vieux = false}'') Players
EOF )
''; }
]
EOF
'';
serviceConfig = { serviceConfig = {
WorkingDirectory = "/var/lib/traque"; WorkingDirectory = "/var/lib/traque";
ExecStart = "${traque-pkg}/bin/traque"; ExecStart = "${traque-pkg}/bin/traque";