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,7 +150,21 @@ in
};
systemd.services = {
traque = {
preStart = ''
path = [ pkgs.outils ];
preStart =
let
token-file = "/var/lib/traque/token";
NPCs = [
"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
@ -158,15 +172,18 @@ in
template_dir = "${traque-pkg}/share/traque-templates"
blurred_move = [0.0005, 0.0005]
bonus_timeout = 5000
bonus_timeout = 120000
event_timeout = 100
admin_token = "root"
fairness_timeout = 30000
admin_token = "$(cat ${token-file})"
serve_static = false
teams = [
{ id = "team00", name = "Équipe 00", vieux = false},
{ id = "team01", name = "Équipe 01", vieux = false},
{ id = "npc0", name = "PNJ 0", vieux = true},
{ id = "npc1", name = "PNJ 1", vieux = true},
${
lib.concatStringsSep ",\n " (
map (npc: ''{ id = "$(${id-gen npc})", name = "${npc}", vieux = true }'') NPCs
++ map (player: ''{ id = "$(${id-gen player})", name = "${player}", vieux = false}'') Players
)
}
]
EOF
'';