_configure.tpl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {{- define "syncthing.configure" -}}
  2. {{/*
  3. https://docs.syncthing.net/users/config.html
  4. Note: Configuration in the above link does not match the subcommands of the cli
  5. To get the correct subcommands, run `syncthing cli config <category>`
  6. It will print all the available subcommands for that category
  7. "Knobs" are exposed under Values.syncthingConfig, We can exposed those to questions.yaml if we want
  8. */}}
  9. configmap:
  10. syncthing-configure:
  11. enabled: true
  12. data:
  13. configure.sh: |
  14. #!/bin/sh
  15. set -e
  16. configDir=/var/syncthing/config
  17. # Make sure the file exists
  18. until [ -f "$configDir/config.xml" ]; do
  19. sleep 2
  20. done
  21. # Check the API is running
  22. until curl --silent --output /dev/null http://localhost:{{ .Values.syncthingNetwork.webPort }}/rest/noauth/health; do
  23. sleep 2
  24. done
  25. function setConfig() {
  26. syncthing cli --home "$configDir" config $@
  27. }
  28. # Now we can use the syncthing cli (wrapper around the API) to set the defaults.
  29. # Keep in mind that all the below values are not enforced, user can change them
  30. # while the app is running, but will be re-applied on restart.
  31. # Category "options" is more like "general" or "global" settings.
  32. setConfig options announce-lanaddresses set -- {{ ternary "1" "0" .Values.syncthingConfig.announceLANAddresses | quote }}
  33. setConfig options global-ann-enabled set -- {{ ternary "1" "0" .Values.syncthingConfig.globalDiscovery | quote }}
  34. setConfig options local-ann-enabled set -- {{ ternary "1" "0" .Values.syncthingConfig.localDiscovery | quote }}
  35. setConfig options natenabled set -- {{ ternary "1" "0" .Values.syncthingConfig.natTraversal | quote }}
  36. setConfig options relays-enabled set -- {{ ternary "1" "0" .Values.syncthingConfig.relaying | quote }}
  37. setConfig options uraccepted set -- {{ ternary "1" "-1" .Values.syncthingConfig.telemetry | quote }}
  38. setConfig options auto-upgrade-intervalh set -- "0"
  39. # Category "defaults/folder" contains the default settings for new folders.
  40. setConfig defaults folder xattr-filter max-total-size set -- 10485760
  41. setConfig defaults folder xattr-filter max-single-entry-size set -- 2097152
  42. setConfig defaults folder send-ownership set -- 1
  43. setConfig defaults folder sync-ownership set -- 1
  44. setConfig defaults folder send-xattrs set -- 1
  45. setConfig defaults folder sync-xattrs set -- 1
  46. {{- end -}}