summaryrefslogtreecommitdiff
path: root/templates/syncthing.fact
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--templates/syncthing.fact (renamed from files/syncthing.fact)9
1 files changed, 3 insertions, 6 deletions
diff --git a/files/syncthing.fact b/templates/syncthing.fact
index 79ea632..406366b 100644
--- a/files/syncthing.fact
+++ b/templates/syncthing.fact
@@ -8,14 +8,11 @@ use strict;
use warnings;
use JSON::PP;
-use LWP::UserAgent;
-my $id = '0000000-0000000-0000000-0000000-0000000-0000000-0000000-0000000';
+`doas -u {{ syncthing_pre.user_group }} syncthing generate --config {{ syncthing_pre.config_dir }} 2>&1` unless -e "{{ syncthing_pre.config_dir }}/config.xml";
-my $resp = LWP::UserAgent->new()->head('http://localhost:8384/');
-if ($resp->code == 200) {
- $id = $resp->header('X-Syncthing-Id');
-}
+my $id = `doas -u {{ syncthing_pre.user_group }} syncthing -device-id --config {{ syncthing_pre.config_dir }} --data {{ syncthing_pre.data_dir }} 2>&1`;
+chomp $id;
my %output = (
'id' => $id,