Open salim-b opened 2 months ago
It should try to read the config from syncthing --paths
which is a syncthing command returning paths, if that does not return anything it should revert back to GLib.get_user_config_dir() + '/syncthing/config.xml'
which is the default path.
It looks like both this things do not return the right file or it fails in executing the syncthing paths command.
Can you test that? I'll then look into making this code more robust...
It should try to read the config from
syncthing --paths
which is a syncthing command returning paths
Yes, I know that. As I wrote above, I've set STCONFDIR
and STDATADIR
explicitly in Syncthing's systemd service unit and in my ~/.bashrc
and syncthing --paths
on a terminal gives me the expected output..
if that does not return anything it should revert back to
GLib.get_user_config_dir() + '/syncthing/config.xml'
which is the default path.
This is not quite correct anymore since
Changed in version 1.27.0: The default location of the configuration and database directory on Unix-like systems was changed to
$XDG_STATE_HOME/syncthing
or$HOME/.local/state/syncthing
. Previously the default config location was$XDG_CONFIG_HOME/syncthing
or$HOME/.config/syncthing
. The database directory was previously$HOME/.config/syncthing
or, if the environment variable was set,$XDG_DATA_HOME/syncthing
. Existing installations may still use these directories instead of the newer defaults.
So what happens I guess is that during GLib.spawn_sync(null, ['syncthing', '--paths'], ...)
STCONFDIR
and STDATADIR
are not set (i.e. ~/.bashrc
is ignored) and hence the config dir this syncthing --paths
invocation returns defaults to $HOME/.local/state/syncthing
– but my Syncthing config is actually located at $HOME/.config/syncthing/config.xml
.
A more robust approach would be to call the REST API of the running Syncthing instance via GET /rest/system/paths
, I guess.
I'm trying to run Syncthing Indicator on the immutable Linux distro Bluefin (which is based on [Universal Blue]() which in turn is based on Fedora Silverblue). Syncthing is installed via
brew install syncthing
.I understand that Syncthing Indicator ships its own systemd service unit, so I did not enable the one shipped with Homebrew (would be enabled via
brew services start syncthing
). Instead, I adapted the one that Syncthing Indicator installed (~/.config/systemd/user/syncthing.service
) toExecStart=/home/linuxbrew/.linuxbrew/bin/syncthing serve --no-browser --no-restart --logflags=0
Environment="STCONFDIR=/var/home/salim/.config/syncthing"
Environment="STDATADIR=/var/home/salim/.local/state/syncthing"
The above env vars are also set in my
~/.bashrc
:After running
systemctl --user daemon-reload; systemctl --user restart syncthing.service
, Syncthing appears to be running fine (systemctl --user status syncthing.service
looks good) and the Syncthing web interface is accessible under the defaulthttp://127.0.0.1:8384/
address.syncthing --paths
on a terminal gives the expected output, i.e. is using the correct config/state directories:But Syncthing Indicator fails to find the Syncthing config. Logs:
(last line is repeated a few more times)
The following code seems responsible to detect Syncthing's config:
https://github.com/2nv2u/gnome-shell-extension-syncthing-indicator/blob/fe58a1a3ea9a9c278c83b31c22f8bcead16e6e95/src/syncthing.js#L359-L401
I guess the reason why it fails in my case is that the
STCONFDIR
andSTDATADIR
env vars are not set duringGLib.spawn_sync(null, ['syncthing', '--paths'], null, GLib.SpawnFlags.SEARCH_PATH, null)
? If so, how could I fix that?