{"id":21289452,"url":"https://github.com/hansmi/stsetup","last_synced_at":"2025-03-15T16:10:12.548Z","repository":{"id":64575100,"uuid":"576743221","full_name":"hansmi/stsetup","owner":"hansmi","description":"Configure Syncthing using jq filter","archived":false,"fork":false,"pushed_at":"2023-12-18T12:00:50.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T05:43:31.494Z","etag":null,"topics":["configuration","jq","syncthing","syncthing-cli"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hansmi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-10T20:46:40.000Z","updated_at":"2022-12-10T20:50:35.000Z","dependencies_parsed_at":"2024-11-21T12:43:15.404Z","dependency_job_id":"ffa939fb-8b4f-434e-8530-589875b52adf","html_url":"https://github.com/hansmi/stsetup","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansmi%2Fstsetup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansmi%2Fstsetup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansmi%2Fstsetup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hansmi%2Fstsetup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hansmi","download_url":"https://codeload.github.com/hansmi/stsetup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243754094,"owners_count":20342542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","jq","syncthing","syncthing-cli"],"created_at":"2024-11-21T12:40:22.321Z","updated_at":"2025-03-15T16:10:12.521Z","avatar_url":"https://github.com/hansmi.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Configuration utility for Syncthing\n\n[![Latest release](https://img.shields.io/github/v/release/hansmi/stsetup)][releases]\n[![Release workflow](https://github.com/hansmi/stsetup/actions/workflows/release.yaml/badge.svg)](https://github.com/hansmi/stsetup/actions/workflows/release.yaml)\n\nManipulate [Syncthing](https://syncthing.net/)'s configuration structure from\nthe command line using a [jq](https://stedolan.github.io/jq/) filter.\n\nSyncthing provides the `syncthing cli config` subcommand for making\nconfiguration changes (e.g.\n`syncthing cli config options start-browser set false`). It works well for most\noptions. Modifying lists of items, e.g. the relay addresses, is more\ncomplicated: items can be added or removed one at a time and there's no command\nto replace or clear the list at once.\n\nThis is where `stsetup` steps in. It fetches the whole configuration using the\n[`/rest/config` API endpoint](https://docs.syncthing.net/rest/config.html),\nalso used by the aforementioned `cli config` subcommand, applies the `jq`\nfilter, and then uploads the configuration again. If a restart is required to\napply the changes made it's also triggered and waited for.\n\n\n## Usage\n\nSyncthing must be installed and configured to be automatically restarted by\na daemon or process control system (e.g. [systemd](https://systemd.io/) or\n[supervisord](http://supervisord.org/)) upon exit.\n\n```shell\n$ cat \u003emyconfig.jq \u003c\u003c'EOF'\n.options += {\n  alwaysLocalNets: [\"10.0.0.0/8\", \"172.16.0.0/12\", \"192.168.0.0/16\"],\n  keepTemporariesH: (3 * 24),\n}\nEOF\n\n$ stsetup -v myconfig.jq\n```\n\nSee the `-h` output for more options.\n\nVariables provided to the `jq` filter:\n\n| Name | Description |\n| --- | --- |\n| `local_device_id` | Device ID of the local instance. |\n\nExample filter using `local_device_id` to set the device name from an\nenvironment variable:\n\n```jq\n.devices += [] |\n(.devices[] | select(.deviceID == $local_device_id)) += {\n  name: env.SYNCTHING_NAME,\n  paused: false,\n}\n```\n\n`stsetup` can be invoked automatically using a systemd service override (e.g.\n`/etc/systemd/user/syncthing.service.d/override.conf`):\n\n```dosini\n[Service]\nExecStartPost=/usr/bin/stsetup /usr/local/share/syncthing/config.jq\n```\n\n\n## Installation\n\nThe code is written as a [Bash](https://www.gnu.org/software/bash/) script\nusing the `jq`, `curl` and `xmllint` programs. The auxiliary `find_unused_port`\nprogram requires Python 3.x.\n\nPre-built packages are provided for [all releases][releases]:\n\n* Debian/Ubuntu (`.deb`)\n* Alpine Linux (`*.apk`)\n\n\n[releases]: https://github.com/hansmi/stsetup/releases/latest\n\n\u003c!-- vim: set sw=2 sts=2 et : --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansmi%2Fstsetup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhansmi%2Fstsetup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansmi%2Fstsetup/lists"}