about summary refs log tree commit diff
path: root/bundles/syncthing/items.py
blob: 8d0622387cf682207d2b57c26d0c5f4f664f5df5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
if node.os != "alpine":
    raise BundleError(f"{node.name}: OS {node.os} is not supported.")

svc_openrc = {
    "syncthing": {
        'enabled': True,
        'running': True,
        'needs': [
            "pkg_apk:syncthing-openrc",
        ],
    },
}

files = {
    "/etc/traefik/syncthing-gui.yaml": {
        'content_type': "mako",
        'source': "traefik.yaml",
        'needs': {"bundle:traefik"},
    },
}

actions = {
    "syncthing_generate_config": {
        'command': "syncthing generate --no-default-folder",
        'unless': "test -d /var/lib/syncthing/.local/state/syncthing",
    },
    "syncthing_patch_config": {
        'command': "patch -sfN -d /var/lib/syncthing -p1",
        'data_stdin': """
--- a/.local/state/syncthing/config.xml
+++ b/.local/state/syncthing/config.xml
@@ -52,7 +52,7 @@
         <numConnections>0</numConnections>
     </device>
     <gui enabled="true" tls="false" debugging="false" sendBasicAuthPrompt="false">
-        <address>127.0.0.1:8384</address>
+        <address>0.0.0.0:8384</address>
         <apikey>bdNpzhDXbZEdcTSAcNtczLGgdV7RpsfF</apikey>
         <theme>default</theme>
     </gui>
""",
        'needs': {"action:syncthing_generate_config"},
        'triggers': {"svc_openrc:syncthing:restart"},
        'unless': "grep -q '0.0.0.0:8384' /var/lib/syncthing/.local/state/syncthing/config.xml",
    },
}