Skip to content

cli subcommand does not use STHOMEDIR env var #9041

Closed

Description

@crazygolem

In the docker container, it seems that the syncthing cli subcommand does not use the STHOMEDIR environment variable added in 1.23.7 (#8957). On the other hand, the serve subcommand works as expected with the new environment variable.

In the session below, I would expect the syncthing cli command without the explicit --home parameter to output the same as the one with the parameter set, instead it uses the default value:

# podman run --name bug --rm -d docker.io/syncthing/syncthing:1.23.7
# podman exec bug sh -c 'export | grep STHOMEDIR'
export STHOMEDIR='/var/syncthing/config'
# podman exec bug sh -c 'syncthing cli show version'
reading device ID: open /var/syncthing/.config/syncthing/cert.pem: no such file or directory
# podman exec bug sh -c 'syncthing cli --home="$STHOMEDIR" show version'
{
  "arch": "amd64",
  "codename": "Fermium Flea",
  "container": true,
  "date": "2023-07-31T03:45:37Z",
  "extra": "",
  "isBeta": false,
  "isCandidate": false,
  "isRelease": true,
  "longVersion": "syncthing v1.23.7 \"Fermium Flea\" (go1.20.7 linux-amd64) [email protected] 2023-07-31 03:45:37 UTC [noupgrade]",
  "os": "linux",
  "stamp": "1690775137",
  "tags": [
    "noupgrade"
  ],
  "user": "docker",
  "version": "v1.23.7"
}

Activity

  1. added
    bug
    needs-triage
    on Aug 18, 2023
  2. added a commit that references this issue on Aug 18, 2023
  3. crazygolem commented on Aug 19, 2023

    @crazygolem
    Author

    It seems that syncthing cli has the same behavior with the environment variables STGUIADDRESS and STGUIAPIKEY, i.e. it doesn't use them when available, and instead --gui-address and --gui-apikey must be provided explicitly.

    As far as I know, those two have been available for some time already to syncthing serve, so maybe the fact that those environment variables don't work for syncthing cli is not a bug proper?

    The fact that #8957 (linked in the release notes) mentions:

    Since these pertain to the environment Syncthign runs in, and also affect multiple subcommands, it would be nice if they could be set in the environment once and for all.

    I just assumed that the env vars were meant to be available for all subcommands that have those arguments.

  4. calmh commented on Aug 19, 2023

    @calmh
    Member

    I agree they should, it's just a historic bug/oversight that they are not.

  5. removed
    needs-triage
    on Aug 19, 2023
  6. cjc7373 commented on Oct 8, 2023

    @cjc7373
    Contributor

    I see syncthing uses two cli frameworks: kong and urfave/cli. Should one be migrated to another?

  7. calmh commented on Oct 8, 2023

    @calmh
    Member

    Ideally, yes. It's the cli subcommand that does different magic for historical reasons.

  8. added a commit that references this issue on Dec 11, 2023
    b71a930
  9. added this to the v1.27.2 milestone on Dec 11, 2023
  10. added
    frozen-due-to-age
    on Apr 9, 2025
  11. locked and limited conversation to collaborators on Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions